]> git.ipfire.org Git - people/ric9/pakfire.git/commitdiff
package: Simplify adding all build packages
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 Jan 2025 17:10:45 +0000 (17:10 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 11 Jan 2025 17:10:45 +0000 (17:10 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/package.c

index e43748735e8de5aba85db0c15b4c391b3604c4ab..89dc60f7ad0b9f4b53082e9eb59a1f188a668aeb 100644 (file)
@@ -2372,7 +2372,6 @@ static int __pakfire_package_add_build_packages(struct pakfire_ctx* ctx,
 static int pakfire_package_add_build_packages(struct pakfire_package* pkg,
                struct json_object* md) {
        struct pakfire_repo* repo = NULL;
-       struct pakfire_packagelist* packages = NULL;
        struct json_object* object = NULL;
        int r;
 
@@ -2392,20 +2391,8 @@ static int pakfire_package_add_build_packages(struct pakfire_package* pkg,
                goto ERROR;
        }
 
-       // Create a new list
-       r = pakfire_packagelist_create(&packages, pkg->ctx);
-       if (r)
-               goto ERROR;
-
-       // Fetch all installed packages
-       r = pakfire_repo_to_packagelist(repo, packages);
-       if (r) {
-               ERROR(pkg->ctx, "Could not fetch packages from installed repository: %m\n");
-               goto ERROR;
-       }
-
        // Add all packages to the array
-       r = pakfire_packagelist_walk(packages, __pakfire_package_add_build_packages, object, 0);
+       r = pakfire_repo_walk_packages(repo, __pakfire_package_add_build_packages, object, 0);
        if (r)
                goto ERROR;
 
@@ -2415,8 +2402,6 @@ static int pakfire_package_add_build_packages(struct pakfire_package* pkg,
                goto ERROR;
 
 ERROR:
-       if (packages)
-               pakfire_packagelist_unref(packages);
        if (repo)
                pakfire_repo_unref(repo);
        if (object)