]> git.ipfire.org Git - pakfire.git/commitdiff
archive: Fix reading arch from legacy source packages
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 29 Apr 2021 10:51:07 +0000 (10:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 29 Apr 2021 10:51:07 +0000 (10:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/archive.c

index 0bf49b34debb6fd0c23edb8e0a43432608fde43b..b242b0a8262bccfe47d9e91b49a9d5d598b42038 100644 (file)
@@ -1384,6 +1384,22 @@ PAKFIRE_EXPORT PakfirePackage pakfire_archive_make_package(PakfireArchive archiv
                        free(r);
        }
 
+       /*
+               Check architecture
+               Legacy package formats use "arch = all" for source packages.
+               We need to check for "type = source" and then reset arch
+       */
+       if (strcmp(arch, "all") == 0) {
+               char* type = pakfire_archive_get(archive, "package", "type");
+               if (type) {
+                       if (strcmp(type, "source") == 0) {
+                               free(arch);
+                               arch = NULL;
+                       }
+               }
+               free(type);
+       }
+
        PakfirePackage pkg = pakfire_package_create(
                archive->pakfire, repo, name, evr, (arch) ? arch : "src"
        );