[pacman-dev] [PATCH 7/7] libmakepkg: disallow using 'any' with other arches

morganamilo morganamilo at gmail.com
Mon Jun 11 20:53:38 UTC 2018


Error if the arch array contains any and any other values. This also
fixes a bug where the check for `$arch == 'any'` which only evaluated
the first value in the array, meaning the rest of the values would not
be linted.

Signed-off-by: morganamilo <morganamilo at gmail.com>
---
 scripts/libmakepkg/lint_pkgbuild/arch.sh.in | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/libmakepkg/lint_pkgbuild/arch.sh.in b/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
index f2c80c73..8a1d2c11 100644
--- a/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
@@ -38,11 +38,16 @@ lint_arch() {
 		return 1
 	fi
 
-	if [[ $arch == 'any' ]]; then
+	if [[ $arch == 'any' && ${#arch[@]} == 1 ]]; then
 		return 0
 	fi
 
 	for a in "${arch[@]}"; do
+		if [[ $a == 'any' ]]; then
+			error "$(gettext "any can not be used with other architectures")"
+			ret=1
+		fi
+
 		if [[ $a = *[![:alnum:]_]* ]]; then
 			error "$(gettext "%s contains invalid characters: '%s'")" \
 					'arch' "${a//[[:alnum:]_]}"
-- 
2.17.1


More information about the pacman-dev mailing list