From 1995c3830e92c97367941d6bc991676dd090570a Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 6 Jan 2025 23:03:04 +0000 Subject: [PATCH] package: Allow building noarch on any host architecture Signed-off-by: Michael Tremer --- src/pakfire/package.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/pakfire/package.c b/src/pakfire/package.c index b0ca108b4..e43748735 100644 --- a/src/pakfire/package.c +++ b/src/pakfire/package.c @@ -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 -- 2.47.3