[pacman-dev] [PATCH] makepkg: check arch overrides for required architecture

Allan McRae allan at archlinux.org
Fri Jul 22 08:02:58 EDT 2011


Check any overrides of the "arch" variable contain the required
architecture.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/makepkg.sh.in |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 19e8b8c..4b8f167 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1471,6 +1471,21 @@ check_sanity() {
 		fi
 	fi
 
+	if (( ${#pkgname[@]} > 1 )); then
+		for i in ${pkgname[@]}; do
+			local arch_list=""
+			eval $(declare -f package_${i} | sed -n 's/\(^[[:space:]]*arch=\)/arch_list=/p')
+			if [[ ${arch_list[@]} && ${arch_list} != 'any' ]]; then
+				if ! in_array $CARCH ${arch_list[@]}; then
+					if (( ! IGNOREARCH )); then
+						error "$(gettext "%s is not available for the '%s' architecture.")" "$i" "$CARCH"
+						ret=1
+					fi
+				fi
+			fi
+		done
+	fi
+
 	local provides_list=()
 	eval $(awk '/^[[:space:]]*provides=/,/\)/' "$BUILDFILE" | \
 		sed -e "s/provides=/provides_list+=/" -e "s/#.*//" -e 's/\\$//')
-- 
1.7.6



More information about the pacman-dev mailing list