.cgroup = "pakfire/execute-XXXXXX",
};
+ // Fetch architectures
+ const char* native_arch = pakfire_arch_native();
+ const char* arch = pakfire_get_arch(pakfire);
+
// argv is invalid
if (!argv || !argv[0])
return -EINVAL;
}
}
+ // Fake architecture
+ if (strcmp(arch, native_arch) != 0) {
+ r = set_environ(&env, "LD_PRELOAD", "/usr/lib/libpakfire_preload.so");
+ if (r)
+ goto ERROR;
+
+ r = set_environ(&env, "UTS_MACHINE", arch);
+ if (r)
+ goto ERROR;
+ }
+
// Make cgroup name
r = pakfire_cgroup_random_name(env.cgroup);
if (r)
# Get a reference to the logger
self.log = self.builder.log
- @property
- def environ(self):
- # Build a minimal environment for executing, but try to inherit TERM and LANG
- env = {}
-
- # Fake UTS_MACHINE, when we cannot use the personality syscall and
- # if the host architecture is not equal to the target architecture.
- if not _pakfire.native_arch() == self.pakfire.arch:
- env.update({
- "LD_PRELOAD" : "/usr/lib/libpakfire_preload.so",
- "UTS_MACHINE" : self.pakfire.arch,
- })
-
- return env
-
def _setup(self):
"""
Sets up the environment by installing some basic packages
# Run it
try:
self.pakfire.execute_script(script, logging_callback=self.log.log,
- environ=self.environ, enable_network=False, interactive=False)
+ enable_network=False, interactive=False)
# Handle if the build script failed
except CommandExecutionError as e:
["/usr/bin/bash", "--login"],
interactive=True,
enable_network=True,
- environ=self.environ,
)