aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Minier <lool@dooz.org>2007-03-31 22:47:33 +0200
committerLoïc Minier <lool@dooz.org>2007-03-31 22:47:33 +0200
commit475cf4ec89d394984172dadc35f95d7edb90eaac (patch)
tree892c5e754f68e5267d96bdd1ab6dc5b609db1455
parent78c12e2cfe056b94112e3207b7dc2305265bc727 (diff)
downloadpbuilder-475cf4ec89d394984172dadc35f95d7edb90eaac.tar
pbuilder-475cf4ec89d394984172dadc35f95d7edb90eaac.tar.gz
* Add function get_control_re() to pbuilder-satisfydepends-funcs to extract the
value of source headers from a control file. * Add function filter_arch_deps() to pbuilder-satisfydepends-aptitude to filter out arch dependencies not for a certain arch. * Source pbuilder-satisfydepends-funcs in pbuilder-satisfydepends-aptitude. * Add support for arch specific build-deps and build-conflicts to pbuilder-satisfydepends-aptitude.
-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"