aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpbuilder-satisfydepends-aptitude52
-rwxr-xr-xpbuilder-satisfydepends-funcs15
2 files changed, 50 insertions, 17 deletions
diff --git a/pbuilder-satisfydepends-aptitude b/pbuilder-satisfydepends-aptitude
index 1fb41a3..078e2d6 100755
--- a/pbuilder-satisfydepends-aptitude
+++ b/pbuilder-satisfydepends-aptitude
@@ -21,6 +21,39 @@
set -e
+. /usr/lib/pbuilder/pbuilder-satisfydepends-funcs
+
+# filter out dependencies sent on input not for this arch; deps can have
+# multiple lines; output is on a single line or "" if empty
+function filter_arch_deps() {
+ local arch="$1"
+ local INSTALLPKGMULTI
+ local INSTALLPKG
+
+ # split on ","
+ sed 's/[[:space:]]*,[[:space:]]*/\n/g' |
+ while read INSTALLPKGMULTI; do
+ echo "$INSTALLPKGMULTI" |
+ # split on "|"
+ sed 's/[[:space:]]*|[[:space:]]*/\n/g' |
+ while read INSTALLPKG; do
+ if echo "$INSTALLPKG" | grep -q '\['; then
+ if checkbuilddep_archdeps "$INSTALLPKG" "$ARCH"; then
+ continue;
+ fi
+ fi
+ # output the selected package, removing the arch list
+ echo "$INSTALLPKG" | sed 's/\[.*\]//'
+ done |
+ # add " | " between entries
+ sed '$,$! s/$/ |/' |
+ xargs --no-run-if-empty
+ done |
+ # add ", " between entries
+ sed '$,$! s/$/,/' |
+ xargs --no-run-if-empty
+}
+
function checkbuilddep_internal () {
# Use this function to fulfill the dependency (almost)
local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
@@ -29,23 +62,8 @@ function checkbuilddep_internal () {
local DEPENDS
local CONFLICTS
echo " -> Attempting to satisfy build-dependencies $Id$"
- DEPENDS="$(cat ${DEBIAN_CONTROL} | \
- awk '
-BEGIN{source=1}
-/^$/ {source=0}
-/^Source:/ {source=1}
-/^[^ ]*:/ {p=0}
-tolower($0) ~ /^'"${BD_REGEXP}"':/ {p=1}
-{if(p && source) {print $0}}' | \
- sed 's/^[^: ]*://')"
- CONFLICTS="$(cat "${DEBIAN_CONTROL}" | \
- awk 'BEGIN{source=1}
-/^$/ {source=0}
-/^Source:/ {source=1}
-/^[^ ]*:/{p=0}
-tolower($0) ~ /^'"${BC_REGEXP}"':/ {p=1}
-{if(p && source) {print $0}}' | \
- sed 's/^[^: ]*://')"
+ DEPENDS="$(get_control_re "$DEBIAN_CONTROL" "$BD_REGEXP" | filter_arch_deps "$ARCH")"
+ CONFLICTS="$(get_control_re "$DEBIAN_CONTROL" "$BC_REGEXP" | filter_arch_deps "$ARCH")"
echo " -> Creating pbuilder-satisfydepends-dummy package"
BUILD_DEP_DEB_DIR="/tmp/satisfydepends-aptitude"
BUILD_DEP_DEB_CONTROL="$BUILD_DEP_DEB_DIR/pbuilder-satisfydepends-dummy/DEBIAN/control"
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs
index 7e4367d..0a4d181 100755
--- a/pbuilder-satisfydepends-funcs
+++ b/pbuilder-satisfydepends-funcs
@@ -50,6 +50,21 @@ function checkbuilddep_versiondeps () {
return 1;
}
+get_control_re() {
+ control="$1"
+ re="$2"
+
+ cat "$control" |
+ awk '
+ BEGIN { source=1 }
+ /^$/ { source=0 }
+ /^Source:/ { source=1 }
+ /^[^ ]*:/ { p=0 }
+ tolower($0) ~ /^'"$re"':/ { p=1 }
+ { if (p && source) { print $0 } }' |
+ sed 's/^[^: ]*://'
+}
+
function checkbuilddep_archdeps () {
# returns FALSE on INSTALL
local INSTALLPKG="$1"