]> git.ipfire.org Git - pakfire.git/commitdiff
packages: Use the new path function to find the package
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 15 Feb 2025 13:06:57 +0000 (13:06 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 15 Feb 2025 13:06:57 +0000 (13:06 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/package.c

index 6256873771e29993e1dd4b7bd793d40cd3138d46..388a00f109f2babc988417f69529465cb668c443 100644 (file)
@@ -2145,36 +2145,22 @@ ERROR:
 
 struct pakfire_archive* pakfire_package_get_archive(struct pakfire_package* pkg) {
        struct pakfire_archive* archive = NULL;
-       struct pakfire_repo* repo = NULL;
        const char* path = NULL;
        int r;
 
-       // Fetch the repository
-       repo = pakfire_package_get_repo(pkg);
-       if (repo) {
-               if (pakfire_repo_is_local(repo)) {
-                       path = pakfire_package_get_string(pkg, PAKFIRE_PKG_PATH);
-                       if (!path)
-                               goto ERROR;
-               }
-       }
-
-       // Otherwise open the archive from the cache
+       // Fetch the path
+       path = pakfire_package_get_path(pkg);
        if (!path)
-               path = pakfire_package_get_string(pkg, PAKFIRE_PKG_CACHE_PATH);
+               return NULL;
 
        // Open archive
        r = pakfire_archive_open(&archive, pkg->pakfire, path);
        if (r) {
                ERROR(pkg->ctx, "Could not open archive for %s (at %s): %m\n",
                        pakfire_package_get_string(pkg, PAKFIRE_PKG_NEVRA), path);
-               goto ERROR;
+               return NULL;
        }
 
-ERROR:
-       if (repo)
-               pakfire_repo_unref(repo);
-
        return archive;
 }