From: Michael Tremer Date: Mon, 8 Aug 2022 17:16:21 +0000 (+0000) Subject: build: Pass context to pakfire_build_run_script X-Git-Tag: 0.9.28~559 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=779e16deff670e6cf8945d6980f4ec09ff89c393;p=pakfire.git build: Pass context to pakfire_build_run_script Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index 1d0d189c3..43c030988 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -101,14 +101,14 @@ ERROR: 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); @@ -116,26 +116,26 @@ static int pakfire_build_run_script(struct pakfire* pakfire, const char* filenam // 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: @@ -196,14 +196,14 @@ static int pakfire_build_find_dependencies(struct pakfire_build* build, }; // 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; @@ -405,7 +405,7 @@ static int pakfire_build_add_scriptlet_requires(struct pakfire_build* build, }; // 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; @@ -712,7 +712,7 @@ static int pakfire_build_run_post_build_scripts( // 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; }