diff options
author | Loïc Minier <lool@dooz.org> | 2010-01-04 23:18:45 +0100 |
---|---|---|
committer | Loïc Minier <lool@dooz.org> | 2010-01-04 23:18:45 +0100 |
commit | 8bf99ca809fd9287bbe015523e477109185a4119 (patch) | |
tree | 42e895a6b8088dabf2704d6d622df42dea175959 /pbuilder-satisfydepends-funcs | |
parent | f798994af1d760954fb6e8d0be0d17e60862e479 (diff) | |
download | pbuilder-8bf99ca809fd9287bbe015523e477109185a4119.tar pbuilder-8bf99ca809fd9287bbe015523e477109185a4119.tar.gz |
Rewrite get_control_re
Replace cat + awk + sed in get_control_re() with a sed script; rename
the function to get_source_control_field.
Diffstat (limited to 'pbuilder-satisfydepends-funcs')
-rwxr-xr-x | pbuilder-satisfydepends-funcs | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs index 58e598c..9beb691 100755 --- a/pbuilder-satisfydepends-funcs +++ b/pbuilder-satisfydepends-funcs @@ -50,45 +50,37 @@ checkbuilddep_versiondeps() { return 1; } -get_control_re() { - # output the field which matches RE of control file in stdout. - re="$1" - - cat "$DEBIAN_CONTROL" | - awk ' - BEGIN { source=1 } - /^$/ { - if (p) { - print s - s="" - } - source=0 - } - /^Source:/ { source=1 } - /^[^ ]*:/ { - if (source && p) { - print s - s="" - } - p=0 - } - /^#/ { next } - tolower($0) ~ /^'"$re"':/ { p=1 } - { if (p && source) { s=s""$0 } }' | - sed 's/^[^: ]*://' +get_source_control_field() { + local field="$1" + + sed -n -e " +s/^$field://i +t store +/^\$/q +d +: store +H +: loop +n +/^#/ b loop +/^[ \\t]/ b store +x +s/\\n//g +p" \ + "$DEBIAN_CONTROL" } get_build_deps() { - get_control_re "build-depends" + get_source_control_field "Build-Depends" if [ "$BINARY_ARCH" = no ]; then - get_control_re "build-depends-indep" + get_source_control_field "Build-Depends-Indep" fi } get_build_conflicts() { - get_control_re "build-conflicts" + get_control_field "Build-Conflicts" if [ "$BINARY_ARCH" = no ]; then - get_control_re "build-conflicts-indep" + get_source_control_field "Build-Conflicts-Indep" fi } |