for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
char *nvr;
const char *a;
+ int header_color;
+ int arch_color;
if (pkg->fileList == NULL)
continue;
goto exit;
a = headerGetString(pkg->header, RPMTAG_ARCH);
- if (rstreq(a, "noarch") && headerGetNumber(pkg->header, RPMTAG_HEADERCOLOR) != 0) {
+ header_color = headerGetNumber(pkg->header, RPMTAG_HEADERCOLOR);
+ if (!rstreq(a, "noarch")) {
+ arch_color = rpmGetArchColor(a);
+ if (arch_color > 0 && !(arch_color & header_color)) {
+ rpmlog(RPMLOG_WARNING,
+ _("Binaries arch (%d) not matching the package arch (%d).\n"),
+ header_color, arch_color);
+ }
+ } else if (header_color != 0) {
int terminate = rpmExpandNumeric("%{?_binaries_in_noarch_packages_terminate_build}");
rpmlog(terminate ? RPMLOG_ERR : RPMLOG_WARNING,
_("Arch dependent binaries in noarch package\n"));
int * num);
/** \ingroup rpmrc
+ * Return color for an arch
+ * @param arch name of an architecture
+ * @return color color of arch, -1 if the arch couldn't be determined
+ */
+int rpmGetArchColor(const char *arch);
+
+/** \ingroup rpmrc
* Return current os name and/or number.
* @todo Generalize to extract os component from target_platform macro.
* @retval name address of os name (or NULL)
/* XXX get rid of this stuff... */
/* Stuff for maintaining "variables" like SOURCEDIR, BUILDDIR, etc */
#define RPMVAR_OPTFLAGS 3
+#define RPMVAR_ARCHCOLOR 42
#define RPMVAR_INCLUDE 43
#define RPMVAR_MACROFILES 49
/* The order of the flags is archSpecific, macroize, localize */
static const struct rpmOption optionTable[] = {
+ { "archcolor", RPMVAR_ARCHCOLOR, 1, 0, 0 },
{ "include", RPMVAR_INCLUDE, 0, 0, 2 },
{ "macrofiles", RPMVAR_MACROFILES, 0, 0, 1 },
{ "optflags", RPMVAR_OPTFLAGS, 1, 1, 0 },
getMachineInfo(ARCH, name, num);
}
+int rpmGetArchColor(const char *arch)
+{
+ const char *color;
+ char *e;
+ int color_i;
+
+ arch = lookupInDefaultTable(arch,
+ tables[currTables[ARCH]].defaults,
+ tables[currTables[ARCH]].defaultsLength);
+ color = rpmGetVarArch(RPMVAR_ARCHCOLOR, arch);
+ if (color == NULL) {
+ return -1;
+ }
+
+ color_i = strtol(color, &e, 10);
+ if (!(e && *e == '\0')) {
+ return -1;
+ }
+
+ return color_i;
+}
+
void rpmGetOsInfo(const char ** name, int * num)
{
getMachineInfo(OS, name, num);