From 19152b3f7db286f75de1b551010eb472260e0749 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Date: Thu, 28 May 2015 12:29:25 +0200 Subject: build profile parsing support --- pbuilder-satisfydepends-funcs | 73 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'pbuilder-satisfydepends-funcs') diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs index e028fa2..30d487b 100755 --- a/pbuilder-satisfydepends-funcs +++ b/pbuilder-satisfydepends-funcs @@ -148,6 +148,37 @@ filter_arch_deps() { xargs --no-run-if-empty } +# filter out dependencies sent on input not for selected build profiles; deps +# can have multiple lines; output is on a single line or "" if empty +filter_restriction_deps() { + local profiles="$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_restrictiondeps "$INSTALLPKG" "$profiles"; then + continue + fi + fi + # output the selected package + echo "$INSTALLPKG" + done | + # remove the restriction list and add " | " between entries + sed 's/<.*>//; $,$! s/$/ |/' | + xargs --no-run-if-empty + done | + # add ", " between entries + sed '$,$! s/$/,/' | + xargs --no-run-if-empty +} + checkbuilddep_archdeps() { # returns FALSE on INSTALL local INSTALLPKG="$1" @@ -182,6 +213,48 @@ checkbuilddep_archdeps() { return 1 } +checkbuilddep_restrictiondeps() { + # returns FALSE on INSTALL + local INSTALLPKG="$1" + local PROFILES="$2" + # restrictions listed between < and > for this dep + local DEP_RESTRICTIONS="$(echo "$INSTALLPKG" | sed -e 's/[^<]*<\(.*\)>.*/\1/' -e 's/>\s\+