diff options
author | Johannes Schauer <josch@debian.org> | 2015-05-28 12:25:06 +0200 |
---|---|---|
committer | Andreas Henriksson <andreas.henriksson@endian.se> | 2015-06-22 10:06:00 +0200 |
commit | b068c8d3289423f7d74a7f8d5886830777d71c27 (patch) | |
tree | b174f189fe647017421956d6f12db29a75379c7a /pbuilder-satisfydepends-funcs | |
parent | 32c1cd2878a265297276b3edcc2ed0cbc8c0c81e (diff) | |
download | pbuilder-b068c8d3289423f7d74a7f8d5886830777d71c27.tar pbuilder-b068c8d3289423f7d74a7f8d5886830777d71c27.tar.gz |
move filter_arch_deps from pbuilder-satisfydepends-aptitude to pbuilder-satisfydepends-funcs and add tests
Diffstat (limited to 'pbuilder-satisfydepends-funcs')
-rwxr-xr-x | pbuilder-satisfydepends-funcs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs index 6c8dc28..e028fa2 100755 --- a/pbuilder-satisfydepends-funcs +++ b/pbuilder-satisfydepends-funcs @@ -117,6 +117,37 @@ get_build_conflicts() { echo "$output" } +# filter out dependencies sent on input not for this arch; deps can have +# multiple lines; output is on a single line or "" if empty +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 + echo "$INSTALLPKG" + done | + # remove the arch 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" |