return NULL;
}
-static int pakfire_build_run_script(struct pakfire* pakfire, const char* filename,
+static int pakfire_build_run_script(struct pakfire_build* build, const char* filename,
const char* args[], char*** output) {
struct pakfire_jail* jail = NULL;
char* script = NULL;
size_t size = 0;
char path[PATH_MAX];
- DEBUG(pakfire, "Running build script '%s'...\n", filename);
+ DEBUG(build->pakfire, "Running build script '%s'...\n", filename);
// Make the source path
pakfire_path_join(path, PAKFIRE_SCRIPTS_DIR, filename);
// Open the source script
FILE* f = fopen(path, "r");
if (!f) {
- ERROR(pakfire, "Could not open %s: %m\n", path);
+ ERROR(build->pakfire, "Could not open %s: %m\n", path);
return 1;
}
// Read the script into memory
int r = pakfire_read_file_into_buffer(f, &script, &size);
if (r) {
- ERROR(pakfire, "Could not read script into memory: %m\n");
+ ERROR(build->pakfire, "Could not read script into memory: %m\n");
goto ERROR;
}
// Create a new jail
- jail = pakfire_build_make_jail(pakfire);
+ jail = pakfire_build_make_jail(build->pakfire);
if (!jail)
goto ERROR;
// Execute the script
r = pakfire_jail_exec_script(jail, script, size, args, output);
if (r) {
- ERROR(pakfire, "Script '%s' failed with status %d\n", filename, r);
+ ERROR(build->pakfire, "Script '%s' failed with status %d\n", filename, r);
}
ERROR:
};
// Find all provides
- r = pakfire_build_run_script(build->pakfire, "find-provides", args, &provides);
+ r = pakfire_build_run_script(build, "find-provides", args, &provides);
if (r) {
ERROR(build->pakfire, "find-provides returned with error %d\n", r);
goto ERROR;
}
// Find all requires
- r = pakfire_build_run_script(build->pakfire, "find-requires", args, &requires);
+ r = pakfire_build_run_script(build, "find-requires", args, &requires);
if (r) {
ERROR(build->pakfire, "find-requires returned with error %d\n", r);
goto ERROR;
};
// Find all pre-requires
- r = pakfire_build_run_script(build->pakfire, "find-prerequires", args, &prerequires);
+ r = pakfire_build_run_script(build, "find-prerequires", args, &prerequires);
if (r)
goto ERROR;
// Run them one by one
for (const char** script = post_build_scripts; *script; script++) {
- int r = pakfire_build_run_script(build->pakfire, *script, args, NULL);
+ int r = pakfire_build_run_script(build, *script, args, NULL);
if (r)
return r;
}