From: Michael Tremer Date: Mon, 8 Aug 2022 16:52:59 +0000 (+0000) Subject: build: Pass context to pakfire_build_stage X-Git-Tag: 0.9.28~565 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4674869700d50d95fbf8363acadc12d477c5fba7;p=pakfire.git build: Pass context to pakfire_build_stage Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index bb406e46c..b74b9bde4 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -629,7 +629,8 @@ ERROR: return r; } -static int pakfire_build_stage(struct pakfire* pakfire, struct pakfire_parser* makefile, const char* stage) { +static int pakfire_build_stage(struct pakfire_build* build, + struct pakfire_parser* makefile, const char* stage) { struct pakfire_jail* jail = NULL; char template[1024]; @@ -644,28 +645,29 @@ static int pakfire_build_stage(struct pakfire* pakfire, struct pakfire_parser* m // Create the build script char* script = pakfire_parser_expand(makefile, "build", template); if (!script) { - ERROR(pakfire, "Could not generate the build script for stage '%s': %m\n", stage); + ERROR(build->pakfire, "Could not generate the build script for stage '%s': %m\n", + stage); goto ERROR; } - INFO(pakfire, "Running build stage '%s'\n", stage); + INFO(build->pakfire, "Running build stage '%s'\n", stage); // Create a new jail - jail = pakfire_build_make_jail(pakfire); + jail = pakfire_build_make_jail(build->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"); + ERROR(build->pakfire, "Could not import environment: %m\n"); goto ERROR; } // Run the script r = pakfire_jail_exec_script(jail, script, strlen(script), NULL, NULL); if (r) { - ERROR(pakfire, "Build stage '%s' failed with status %d\n", stage, r); + ERROR(build->pakfire, "Build stage '%s' failed with status %d\n", stage, r); } ERROR: @@ -751,7 +753,7 @@ static int pakfire_build_makefile(struct pakfire_build* build, const char* path) // Run through all build stages for (const char** stage = stages; *stage; stage++) { - r = pakfire_build_stage(build->pakfire, makefile, *stage); + r = pakfire_build_stage(build, makefile, *stage); if (r) { // Drop to a shell for debugging if (pakfire_has_flag(build->pakfire, PAKFIRE_FLAGS_INTERACTIVE))