]> git.ipfire.org Git - people/ric9/pakfire.git/commitdiff
package: Allow building noarch on any host architecture
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 6 Jan 2025 23:03:04 +0000 (23:03 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 6 Jan 2025 23:03:04 +0000 (23:03 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/package.c

index b0ca108b422290e5a231dca157497918c2412347..e43748735e8de5aba85db0c15b4c391b3604c4ab 100644 (file)
@@ -1303,8 +1303,9 @@ size_t pakfire_package_get_size(struct pakfire_package* pkg) {
 // Build
 
 int pakfire_package_supports_build_arch(struct pakfire_package* pkg, const char* arch) {
-       int r;
+       int supported = 0;
 
+       // Fetch all supported arches for this package
        char** supported_arches = pakfire_package_get_strings(pkg, PAKFIRE_PKG_BUILD_ARCHES);
 
        // If no build arches are configured, this package supports all arches
@@ -1312,21 +1313,22 @@ int pakfire_package_supports_build_arch(struct pakfire_package* pkg, const char*
                return 1;
 
        for (char** supported_arch = supported_arches; *supported_arch; supported_arch++) {
-               if (strcmp(arch, *supported_arch) == 0) {
-                       r = 1;
-                       goto END;
+               // noarch can be built on any host
+               if (pakfire_string_equals(*supported_arch, "noarch")) {
+                       supported = 1;
+                       break;
+
+               } else if (pakfire_string_equals(*supported_arch, arch)) {
+                       supported = 1;
+                       break;
                }
        }
 
-       // No match found
-       r = 0;
-
-END:
        // Cleanup
        if (supported_arches)
                pakfire_strings_free(supported_arches);
 
-       return r;
+       return supported;
 }
 
 // Dependencies