aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-satisfydepends-funcs
diff options
context:
space:
mode:
Diffstat (limited to 'pbuilder-satisfydepends-funcs')
-rwxr-xr-xpbuilder-satisfydepends-funcs35
1 files changed, 24 insertions, 11 deletions
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs
index f4cae2d..64436a0 100755
--- a/pbuilder-satisfydepends-funcs
+++ b/pbuilder-satisfydepends-funcs
@@ -123,19 +123,32 @@ checkbuilddep_archdeps() {
local ARCH="$2"
# architectures listed between [ and ] for this dep
local DEP_ARCHES="$(echo "$INSTALLPKG" | sed 's/.*\[\(.*\)\].*/\1/')"
- # check for !$ARCH in DEP_ARCHES
- if echo "$DEP_ARCHES" | egrep -q "(^|[[:space:]/]+)\![[:space:]/]*$ARCH($|[[:space:]/]+)"; then
- return 0;
+ local PKG="$(echo "$INSTALLPKG" | cut -d ' ' -f 1)"
+ local USE_IT
+ local IGNORE_IT
+ local INCLUDE
+ # Use 'dpkg-architecture' to support architecture wildcards.
+ for d in $DEP_ARCHES; do
+ if echo "$d" | grep -q '!'; then
+ d="$(echo $d | sed 's/!//')"
+ if dpkg-architecture -a$ARCH -i$d; then
+ IGNORE_IT="yes"
+ fi
+ else
+ if dpkg-architecture -a$ARCH -i$d; then
+ USE_IT="yes"
+ fi
+ INCLUDE="yes"
+ fi
+ done
+ if [ $IGNORE_IT ] && [ $USE_IT ]; then
+ printf "W: inconsistent arch restriction on $PKG: " >&2
+ printf "$DEP_ARCHES depedency\n" >&2
fi
- # check for a "!" which would mean there's a !<otherarch> and hence $ARCH
- # is included
- if ! echo "$DEP_ARCHES" | grep -q '!'; then
- # check for $ARCH in DEP_ARCHES
- if ! echo "$DEP_ARCHES" | egrep -q "(^|[[:space:]/]+)$ARCH($|[[:space:]/]+)"; then
- return 0;
- fi
+ if [ $IGNORE_IT ] || ( [ $INCLUDE ] && [ ! $USE_IT ] ); then
+ return 0
fi
- return 1;
+ return 1
}
checkbuilddep_provides() {