From 475cf4ec89d394984172dadc35f95d7edb90eaac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Sat, 31 Mar 2007 22:47:33 +0200 Subject: * 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. --- pbuilder-satisfydepends-aptitude | 52 +++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 17 deletions(-) (limited to 'pbuilder-satisfydepends-aptitude') 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" -- cgit v1.2.3