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

index a03ba126b2a2e23ee54e91effe636a74542425ea..1d0d189c3e282ad3caff01fc035824eb4a1aac10 100644 (file)
@@ -164,14 +164,14 @@ static int find_dependency(char** haystack, const char* needle) {
        return 0;
 }
 
-static int pakfire_build_find_dependencies(struct pakfire* pakfire,
+static int pakfire_build_find_dependencies(struct pakfire_build* build,
                struct pakfire_package* pkg, struct pakfire_filelist* filelist, const char* buildroot) {
        char** provides = NULL;
        char** requires = NULL;
        char path[PATH_MAX];
 
        // Allocate path to write the filelist to
-       int r = pakfire_make_path(pakfire, path, "tmp/.pakfire-filelist.XXXXXX");
+       int r = pakfire_make_path(build->pakfire, path, "tmp/.pakfire-filelist.XXXXXX");
        if (r < 0)
                return 1;
 
@@ -184,11 +184,11 @@ static int pakfire_build_find_dependencies(struct pakfire* pakfire,
        r = pakfire_filelist_export(filelist, f);
        fclose(f);
        if (r) {
-               ERROR(pakfire, "Could not export filelist: %m\n");
+               ERROR(build->pakfire, "Could not export filelist: %m\n");
                goto ERROR;
        }
 
-       const char* root = pakfire_get_path(pakfire);
+       const char* root = pakfire_get_path(build->pakfire);
 
        // Pass buildroot and the filelist as arguments
        const char* args[] = {
@@ -196,23 +196,23 @@ static int pakfire_build_find_dependencies(struct pakfire* pakfire,
        };
 
        // Find all provides
-       r = pakfire_build_run_script(pakfire, "find-provides", args, &provides);
+       r = pakfire_build_run_script(build->pakfire, "find-provides", args, &provides);
        if (r) {
-               ERROR(pakfire, "find-provides returned with error %d\n", r);
+               ERROR(build->pakfire, "find-provides returned with error %d\n", r);
                goto ERROR;
        }
 
        // Find all requires
-       r = pakfire_build_run_script(pakfire, "find-requires", args, &requires);
+       r = pakfire_build_run_script(build->pakfire, "find-requires", args, &requires);
        if (r) {
-               ERROR(pakfire, "find-requires returned with error %d\n", r);
+               ERROR(build->pakfire, "find-requires returned with error %d\n", r);
                goto ERROR;
        }
 
        // Add all provides to the package
        if (provides) {
                for (char** element = provides; *element; element++) {
-                       DEBUG(pakfire, "Adding provides: %s\n", *element);
+                       DEBUG(build->pakfire, "Adding provides: %s\n", *element);
                        pakfire_package_add_provides(pkg, *element);
                }
        }
@@ -224,7 +224,7 @@ static int pakfire_build_find_dependencies(struct pakfire* pakfire,
                        if (find_dependency(provides, *element))
                                continue;
 
-                       DEBUG(pakfire, "Adding requires: %s\n", *element);
+                       DEBUG(build->pakfire, "Adding requires: %s\n", *element);
                        pakfire_package_add_requires(pkg, *element);
                }
        }
@@ -318,7 +318,7 @@ static int pakfire_build_package_add_files(struct pakfire_build* build,
                goto ERROR;
 
        // Find dependencies
-       r = pakfire_build_find_dependencies(build->pakfire, pkg, filelist, buildroot);
+       r = pakfire_build_find_dependencies(build, pkg, filelist, buildroot);
        if (r) {
                ERROR(build->pakfire, "Finding dependencies failed: %m\n");
                goto ERROR;