]> git.ipfire.org Git - pakfire.git/commitdiff
build: Pass context to pakfire_build_stage
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Aug 2022 16:52:59 +0000 (16:52 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Aug 2022 16:52:59 +0000 (16:52 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c

index bb406e46c5282d5a611384a1e13d5890f8865564..b74b9bde40c3f1bf0740ff0e0ae43c0f88117c9a 100644 (file)
@@ -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))