From 61754016baf1b8f4e86ccb3a49da335b7594e07e Mon Sep 17 00:00:00 2001 From: Loïc Minier Date: Mon, 4 Jan 2010 23:52:22 +0100 Subject: Normalize output of get_source_control_field() --- pbuilder-satisfydepends-funcs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'pbuilder-satisfydepends-funcs') diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs index 9beb691..5c43e34 100755 --- a/pbuilder-satisfydepends-funcs +++ b/pbuilder-satisfydepends-funcs @@ -53,20 +53,34 @@ checkbuilddep_versiondeps() { get_source_control_field() { local field="$1" - sed -n -e " -s/^$field://i + sed -n -e "s/^$field://i" -e ' t store -/^\$/q +/^$/q d : store H : loop n /^#/ b loop -/^[ \\t]/ b store +/^[ \t]/ b store x -s/\\n//g -p" \ +# output on single line +s/\n//g +# change series of tabs and spaces into a space +s/[\t ]\+/ /g +# normalize space before and after commas +s/ *, */, /g +# normalize space before and after pipes +s/ *| */ | /g +# normalize space before and after parentheses +s/ *( */ (/g +s/ *) */)/g +# normalize space between operator and version +s/(\(>>\|>=\|>\|==\|=\|<=\|<<\|<\|!=\) *\([^)]*\))/(\1 \2)/g +# normalize space at beginning and end of line +s/^ *// +s/ *$// +p' \ "$DEBIAN_CONTROL" } -- cgit v1.2.3