Skip to content

Commit 36afca1

Browse files
committed
proc/01-core-defines: allow arch groups in FAIL_ARCH
1 parent 16b6fbc commit 36afca1

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

proc/01-core-defines.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,37 @@ if [ -n "$ALLOW_ARCH" ] && [ "${ABBUILD%%\/*}" != $ALLOW_ARCH ]; then
9292
abdie "This package can only be built on $ALLOW_ARCH, not including $ABHOST."
9393
fi
9494
# shellcheck disable=SC2053
95-
[[ ${ABHOST} != $FAIL_ARCH ]] ||
95+
# Now, we need to match not only the ARCH itself, we also have to match every
96+
# ABHOST_GROUPs (e.g. retro, mainline, etc.).
97+
# Three types of expressions are handled:
98+
# - "!(a|b|c)", matching anything except a, b and c, so the build is only
99+
# available to a, b and c.
100+
# - "@(a|b|c)", matching a, b and c, so the build is not available to a,
101+
# b and c.
102+
# - "arch" or "group", disallowing build for one arch/group.
103+
# NOTE:
104+
# - Expressions such as "a|b|c" or "(a|b|c)" are invalid.
105+
last_status=0
106+
if [ "${FAIL_ARCH##\!}" != "$FAIL_ARCH" ] ; then
107+
chk_op="!="
108+
else
109+
chk_op="=="
110+
fi
111+
for match in "$ABHOST" "${ABHOST_GROUP[@]}" ; do
112+
if eval "[[ \$match $chk_op \$FAIL_ARCH ]]" ; then
113+
last_status=0
114+
break
115+
else
116+
last_status=1
117+
fi
118+
done
119+
if [ "$chk_op" = "==" ] ; then
120+
last_status="$(( !last_status ))"
121+
fi
122+
if [ "$last_status" != "0" ] ; then
96123
abdie "This package cannot be built for $FAIL_ARCH, e.g. $ABHOST."
124+
fi
125+
unset last_status chk_op
97126

98127
if ! bool "$ABSTRIP" && bool "$ABSPLITDBG"; then
99128
abwarn "QA: ELF stripping is turned OFF."

0 commit comments

Comments
 (0)