}
static int pakfire_build_stage(struct pakfire* pakfire, struct pakfire_parser* makefile, const char* stage) {
+ struct pakfire_jail* jail = NULL;
char template[1024];
// Prepare template for this stage
INFO(pakfire, "Running build stage '%s'\n", stage);
- r = pakfire_execute_script(pakfire, script, strlen(script), NULL, envp, 0, NULL, NULL);
+ // Create a new jail
+ jail = pakfire_build_make_jail(pakfire);
+ if (!jail)
+ goto ERROR;
+
+ // Import environment
+ r = pakfire_jail_import_env(jail, (const char**)envp);
+ if (r) {
+ ERROR(pakfire, "Could not import environment: %m\n");
+ goto ERROR;
+ }
+
+ // Run the script
+ r = pakfire_jail_exec_script(jail, script, strlen(script), NULL);
if (r) {
ERROR(pakfire, "Build stage '%s' failed with status %d\n", stage, r);
}
ERROR:
+ if (jail)
+ pakfire_jail_unref(jail);
if (envp) {
for (char** e = envp; *e; e++)
free(*e);