Skip to content

Commit 89c991c

Browse files
committed
Refactor the package color check
Invert and split the conditionals to make the whole (hopefully) a bit easier to read. No functional change.
1 parent 7e5a1a1 commit 89c991c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

build/rpmfc.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,18 +1649,19 @@ static rpmRC rpmfcCheckPackageColor(rpmfc fc)
16491649
unsigned ix;
16501650
int header_color = headerGetNumber(pkg->header, RPMTAG_HEADERCOLOR);
16511651
int arch_color = rpmGetArchColor(a);
1652+
bool is_noarch = rstreq(a, "noarch");
16521653
bool terminate = false;
16531654

1654-
if (!rstreq(a, "noarch")) {
1655-
if (arch_color > 0 && header_color > 0 &&
1656-
!(arch_color & header_color)) {
1657-
msg = "Binaries not matching package arch (%s):\n%s";
1658-
} else {
1655+
/* Return early if no outlier binaries are present */
1656+
if (is_noarch) {
1657+
if (!header_color)
16591658
return RPMRC_OK;
1660-
}
1661-
} else if (header_color != 0) {
16621659
terminate = rpmExpandNumeric("%{?_binaries_in_noarch_packages_terminate_build}");
16631660
msg = "Arch dependent binaries in noarch package (%s):\n%s";
1661+
} else if (arch_color <= 0 || header_color <= 0) {
1662+
return RPMRC_OK;
1663+
} else if (!(arch_color & header_color)) {
1664+
msg = "Binaries not matching package arch (%s):\n%s";
16641665
} else {
16651666
return RPMRC_OK;
16661667
}

0 commit comments

Comments
 (0)