From: Michael Tremer Date: Tue, 20 Sep 2022 09:58:41 +0000 (+0000) Subject: package: Drop support for reading legacy filelists X-Git-Tag: 0.9.28~292 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a83d9e9fed66a9ff4ef621401d819b6e6f00cf68;p=pakfire.git package: Drop support for reading legacy filelists Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/package.c b/src/libpakfire/package.c index 055b8ea5c..5d53efbdb 100644 --- a/src/libpakfire/package.c +++ b/src/libpakfire/package.c @@ -1253,63 +1253,22 @@ PAKFIRE_EXPORT struct pakfire_archive* pakfire_package_get_archive(struct pakfir return archive; } -static int pakfire_package_fetch_legacy_filelist(struct pakfire_package* pkg, struct pakfire_filelist* filelist) { - pakfire_package_internalize_repo(pkg); - - struct pakfire_repo* repo = pakfire_package_get_repo(pkg); - Solvable* s = get_solvable(pkg); - Repo* _repo = pakfire_repo_get_repo(repo); - pakfire_repo_unref(repo); - - int found_marker = 0; - - Id id, *ids; - ids = _repo->idarraydata + s->provides; - while((id = *ids++) != 0) { - const char* path = pakfire_dep2str(pkg->pakfire, id); - - if (found_marker) { - struct pakfire_file* file; - - int r = pakfire_file_create(&file, pkg->pakfire); - if (r) - return r; - - // Set path - pakfire_file_set_path(file, path); - - r = pakfire_filelist_append(filelist, file); - if (r) - return r; - - pakfire_file_unref(file); - continue; - } - - if (strcmp(path, "solvable:filemarker") == 0) - ++found_marker; - } - - return 0; -} - static int pakfire_package_fetch_filelist(struct pakfire_package* pkg, struct pakfire_filelist* filelist) { - int r; + struct pakfire_file* file = NULL; + Dataiterator di; + int r = 0; pakfire_package_internalize_repo(pkg); Solvable* s = get_solvable(pkg); - Dataiterator di; dataiterator_init(&di, s->repo->pool, s->repo, pkg->id, SOLVABLE_FILELIST, NULL, SEARCH_FILES | SEARCH_COMPLETE_FILELIST); while (dataiterator_step(&di)) { - struct pakfire_file* file; - r = pakfire_file_create(&file, pkg->pakfire); if (r) - return r; + goto ERROR; pakfire_file_set_path(file, di.kv.str); @@ -1317,20 +1276,14 @@ static int pakfire_package_fetch_filelist(struct pakfire_package* pkg, struct pa pakfire_filelist_append(filelist, file); pakfire_file_unref(file); } - dataiterator_free(&di); - // If the file list is empty, we fall back to read files - // in the older format. - if (pakfire_filelist_is_empty(filelist)) { - r = pakfire_package_fetch_legacy_filelist(pkg, filelist); - if (r) - return r; - } +ERROR: + dataiterator_free(&di); // Sort the list pakfire_filelist_sort(filelist); - return 0; + return r; } PAKFIRE_EXPORT struct pakfire_filelist* pakfire_package_get_filelist(struct pakfire_package* pkg) {