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

morganamilo morganamilo at gmail.com
Tue Jan 15 22:41:34 UTC 2019


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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/libmakepkg/lint_pkgbuild/arch.sh.in b/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
index ef1aac46..3b1d0ce7 100644
--- a/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/arch.sh.in
@@ -33,8 +33,13 @@ lint_pkgbuild_functions+=('lint_arch')
 lint_arch() {
 	local a name list ret=0
 
-	if [[ $arch == 'any' ]]; then
-		return 0
+	if in_array "any" "${arch[@]}"; then
+		if (( ${#arch[@]} == 1 )); then
+			return 0;
+		else
+			error "$(gettext "Can not use '%s' architecture with other architectures")" "any"
+			return 1;
+		fi
 	fi
 
 	for a in "${arch[@]}"; do
-- 
2.20.1


More information about the pacman-dev mailing list