The following commit has been merged in the master branch:
commit 31e362e46ccacc1fa0936cf80b1eaf72b45fe2f5
Author: James Vega <[email protected]>
Date: Sat Oct 8 18:17:37 2011 -0400
mergechanges: Use awk to properly process the final output.
Closes: #640782
Signed-off-by: James Vega <[email protected]>
diff --git a/debian/changelog b/debian/changelog
index 3100fe7..1f074fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,8 @@ devscripts (2.11.2) UNRELEASED; urgency=low
for the patch. (Closes: #641497)
* debchange: Document that only `$1' backreference replacements are
supported. Thanks to Matthijs Kooijman for the patch. (Closes: #639813)
+ * mergechanges: Use awk instead of sed to handle massaging the final output
+ so we can better control the processing. (Closes: #640782)
[ Stefano Rivera ]
* debchange: Add precise as a recognised Ubuntu distro.
diff --git a/scripts/mergechanges.sh b/scripts/mergechanges.sh
index bb8fceb..36407e1 100755
--- a/scripts/mergechanges.sh
+++ b/scripts/mergechanges.sh
@@ -25,7 +25,7 @@ PROGNAME=`basename $0`
usage () {
echo \
-"Usage: $PROGNAME [--help|--version] [-f] <file1> <file2> [<file> ...]
+"Usage: $PROGNAME [-h|--help|--version] [-f] <file1> <file2> [<file> ...]
Merge the changes files <file1>, <file2>, .... Output on stdout
unless -f option given, in which case, output to
<package>_<version>_multi.changes in the same directory as <file1>."
@@ -46,7 +46,7 @@ FILE=0
while [ $# -gt 0 ]; do
case "$1" in
- --help)
+ -h|--help)
usage
exit 0
;;
@@ -188,14 +188,27 @@ else
cp "$1" ${OUTPUT}
fi
-# Replace the Architecture: field, nuke the value of Files:, and insert
-# the Description: field before the Changes: field
-eval "sed -e 's,^Architecture: .*,Architecture: ${ARCHS},' \
- -e '/^Checksums-.*:/,/^[^ ]/{/^Checksums-.*:/d;/^ /d}' \
- -e '/^Files:/,/^[^ ]/{/^Files:/d;/^ /d}' \
- -e '/^Description:/,/^[^ ]/{/^Description:/d;/^ /d}' \
- -e '/^Changes:/{r '${DESCFILE} -e ';aChanges: ' -e ';d}' \
- -e 's,^Format: .*,Format: ${FORMATS},' \
+# Replace the Architecture: field, nuke the value of Checksums-*: and Files:,
+# and insert the Description: field before the Changes: field
+eval "awk -- '/^[^ ]/{ field=\"\" }
+ /^ /{
+ if (length(field) != 0) {
+ print
+ }
+ next
+ }
+ /^Architecture: /{printf \"%s ${ARCHS}\\n\", \$1; next}
+ /^Changes:/{
+ field=\$0
+ while ((getline < \"${DESCFILE}\") > 0) {
+ print
+ }
+ printf \"%s\\n\", field
+ next
+ }
+ /^Format: /{ printf \"%s ${FORMATS}\\n\", \$1; next}
+ /^(Checksums-.*|Files|Description):/{ next }
+ { print }' \
${OUTPUT} ${REDIR1}"
# Voodoo magic to get the merged file and checksum lists into the output
--
Git repository for devscripts
--
To unsubscribe, send mail to [email protected].