From: Michael Tremer Date: Mon, 8 Aug 2022 16:48:43 +0000 (+0000) Subject: build: Pass context to pakfire_build_makefile X-Git-Tag: 0.9.28~566 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87bb7749110523444cf9ed8322989e8c0993e692;p=pakfire.git build: Pass context to pakfire_build_makefile Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/build.c b/src/libpakfire/build.c index f765a8056..bb406e46c 100644 --- a/src/libpakfire/build.c +++ b/src/libpakfire/build.c @@ -714,17 +714,16 @@ static int pakfire_build_run_post_build_scripts(struct pakfire* pakfire, const c return 0; } -static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, const char* target, - uuid_t* build_id, int flags) { +static int pakfire_build_makefile(struct pakfire_build* build, const char* path) { struct pakfire_parser* makefile = NULL; char buildroot[PATH_MAX]; struct pakfire_parser_error* error = NULL; int r = 1; - const char* root = pakfire_get_path(pakfire); + const char* root = pakfire_get_path(build->pakfire); // Create BUILDROOT - pakfire_make_path(pakfire, buildroot, "/tmp/.buildroot.XXXXXX"); + pakfire_make_path(build->pakfire, buildroot, "/tmp/.buildroot.XXXXXX"); if (!pakfire_mkdtemp(buildroot)) goto ERROR; @@ -734,14 +733,14 @@ static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, con goto ERROR; // Read makefile - r = pakfire_read_makefile(&makefile, pakfire, path, &error); + r = pakfire_read_makefile(&makefile, build->pakfire, path, &error); if (r) { if (error) { - ERROR(pakfire, "Could not parse makefile %s: %s\n", path, + ERROR(build->pakfire, "Could not parse makefile %s: %s\n", path, pakfire_parser_error_get_message(error)); pakfire_parser_error_unref(error); } else { - ERROR(pakfire, "Could not parse makefile %s: %m\n", path); + ERROR(build->pakfire, "Could not parse makefile %s: %m\n", path); } goto ERROR; @@ -752,25 +751,26 @@ static int pakfire_build_makefile(struct pakfire* pakfire, const char* path, con // Run through all build stages for (const char** stage = stages; *stage; stage++) { - r = pakfire_build_stage(pakfire, makefile, *stage); + r = pakfire_build_stage(build->pakfire, makefile, *stage); if (r) { // Drop to a shell for debugging - if (pakfire_has_flag(pakfire, PAKFIRE_FLAGS_INTERACTIVE)) - pakfire_jail_shell(pakfire); + if (pakfire_has_flag(build->pakfire, PAKFIRE_FLAGS_INTERACTIVE)) + pakfire_jail_shell(build->pakfire); goto ERROR; } } // Run post build scripts - r = pakfire_build_run_post_build_scripts(pakfire, buildroot_rel); + r = pakfire_build_run_post_build_scripts(build->pakfire, buildroot_rel); if (r) goto ERROR; // Create the packages - r = pakfire_build_packages(pakfire, makefile, build_id, buildroot_rel, target); + r = pakfire_build_packages(build->pakfire, makefile, &build->id, + buildroot_rel, build->target); if (r) { - ERROR(pakfire, "Could not create packages: %m\n"); + ERROR(build->pakfire, "Could not create packages: %m\n"); goto ERROR; } @@ -1018,8 +1018,7 @@ PAKFIRE_EXPORT int pakfire_build_exec(struct pakfire_build* build, const char* p } // Run build - r = pakfire_build_makefile(build->pakfire, makefile, build->target, - &build->id, build->flags); + r = pakfire_build_makefile(build, makefile); if (r) { ERROR(build->pakfire, "Could not build %s: %m\n", nevra); goto ERROR;