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;
}