// 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
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