[pacman-dev] [PATCH 1/2] makepkg: respect package depends for dep checks

Dave Reisner dreisner at archlinux.org
Sun Dec 28 17:31:49 UTC 2014


Include package-specific and arch-specific dependencies when checking
dependencies prior to the build.

Fixes: https://bugs.archlinux.org/task/42191
---
 scripts/makepkg.sh.in | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 0db9912..6565809 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -2537,6 +2537,22 @@ pkgbuild_get_attribute() {
 	fi
 }
 
+pkgbuild_get_all_for_arch() {
+	# $1: attribute name
+	# $2: architecture
+	# $3: output variable
+	local pkg __all l
+
+	array_build __all "$1"
+	for pkg in "${pkgname[@]}"; do
+		pkgbuild_get_attribute "$pkg" "$1" 1 l && __all+=("${l[@]}")
+		pkgbuild_get_attribute "$pkg" "$1_$2" 1 l && __all+=("${l[@]}")
+	done
+
+	mapfile -t __all < <(printf '%s\n' "${__all[@]}" | awk '!_[$0]++')
+	array_build "$3" __all
+}
+
 lint_pkgbase() {
 	if [[ ${pkgbase:0:1} = "-" ]]; then
 		error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
@@ -3626,7 +3642,8 @@ else
 	deperr=0
 
 	msg "$(gettext "Checking runtime dependencies...")"
-	resolve_deps ${depends[@]} || deperr=1
+	pkgbuild_get_all_for_arch 'depends' "$CARCH" all_deps
+	resolve_deps "${all_deps[@]}" || deperr=1
 
 	if (( RMDEPS && INSTALL )); then
 		original_pkglist=($(run_pacman -Qq))    # required by remove_dep
-- 
2.2.1


More information about the pacman-dev mailing list