char duration[TIME_STRING_MAX];
int r;
+ // Fetch architecture
+ const char* arch = pakfire_get_arch(build->pakfire);
+
// Set buildroot
r = pakfire_path(build->pakfire, build->buildroot, "%s",
PAKFIRE_TMP_DIR "/pakfire-buildroot.XXXXXX");
INFO(build->pakfire, "Building %s...\n", nevra);
+ // Check if this package can be build in this environment
+ if (!pakfire_package_supports_build_arch(package, arch)) {
+ ERROR(build->pakfire, "%s does not support being built on %s\n", nevra, arch);
+ r = -ENOTSUP;
+ goto ERROR;
+ }
+
// Initialize the build environment
r = pakfire_build_init(build);
if (r)
const enum pakfire_package_key key, const char* value);
int pakfire_package_is_source(struct pakfire_package* pkg);
+int pakfire_package_supports_build_arch(struct pakfire_package* pkg, const char* arch);
char* pakfire_package_join_evr(const char* e, const char* v, const char* r);
return pakfire_package_get_num(pkg, PAKFIRE_PKG_DOWNLOADSIZE, 0);
}
+// Build
+
+int pakfire_package_supports_build_arch(struct pakfire_package* pkg, const char* arch) {
+ int r;
+
+ char** supported_arches = pakfire_package_get_strings(pkg, PAKFIRE_PKG_BUILD_ARCHES);
+
+ // If no build arches are configured, this package supports all arches
+ if (!supported_arches)
+ return 1;
+
+ for (char** supported_arch = supported_arches; *supported_arch; supported_arch++) {
+ if (strcmp(arch, *supported_arch) == 0) {
+ r = 1;
+ goto END;
+ }
+ }
+
+ // No match found
+ r = 0;
+
+END:
+ // Cleanup
+ if (supported_arches)
+ pakfire_strings_free(supported_arches);
+
+ return r;
+}
+
// Dependencies
PAKFIRE_EXPORT char** pakfire_package_get_deps(struct pakfire_package* pkg,