static int checkForValidArchitectures(Spec spec) /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ /*@modifies rpmGlobalMacroContext, internalState @*/ { const char *arch = rpmExpand("%{_target_cpu}", NULL); const char *os = rpmExpand("%{_target_os}", NULL); int rc = RPMRC_FAIL; /* assume failure. */ if (isMemberInEntry(spec->sourceHeader, arch, RPMTAG_EXCLUDEARCH) == 1) { rpmlog(RPMLOG_ERR, _("Architecture is excluded: %s\n"), arch); goto exit; } if (isMemberInEntry(spec->sourceHeader, arch, RPMTAG_EXCLUSIVEARCH) == 0) { rpmlog(RPMLOG_ERR, _("Architecture is not included: %s\n"), arch); goto exit; } if (isMemberInEntry(spec->sourceHeader, os, RPMTAG_EXCLUDEOS) == 1) { rpmlog(RPMLOG_ERR, _("OS is excluded: %s\n"), os); goto exit; } if (isMemberInEntry(spec->sourceHeader, os, RPMTAG_EXCLUSIVEOS) == 0) { rpmlog(RPMLOG_ERR, _("OS is not included: %s\n"), os); goto exit; } rc = 0; exit: arch = _free(arch); os = _free(os); return rc; }
static rpmRC checkForValidArchitectures(rpmSpec spec) { char *arch = rpmExpand("%{_target_cpu}", NULL); char *os = rpmExpand("%{_target_os}", NULL); rpmRC rc = RPMRC_FAIL; /* assume failure */ if (!strcmp(arch, "noarch")) { free(arch); arch = rpmExpand("%{_build_cpu}", NULL); } if (isMemberInEntry(spec->buildRestrictions, arch, RPMTAG_EXCLUDEARCH) == 1) { rpmlog(RPMLOG_ERR, _("Architecture is excluded: %s\n"), arch); goto exit; } if (isMemberInEntry(spec->buildRestrictions, arch, RPMTAG_EXCLUSIVEARCH) == 0) { rpmlog(RPMLOG_ERR, _("Architecture is not included: %s\n"), arch); goto exit; } if (isMemberInEntry(spec->buildRestrictions, os, RPMTAG_EXCLUDEOS) == 1) { rpmlog(RPMLOG_ERR, _("OS is excluded: %s\n"), os); goto exit; } if (isMemberInEntry(spec->buildRestrictions, os, RPMTAG_EXCLUSIVEOS) == 0) { rpmlog(RPMLOG_ERR, _("OS is not included: %s\n"), os); goto exit; } rc = RPMRC_OK; exit: free(arch); free(os); return rc; }