Author: adam-guest
Date: 2008-02-27 00:13:16 +0000 (Wed, 27 Feb 2008)
New Revision: 1065

Modified:
   trunk/Devscripts/Debbugs.pm
   trunk/debian/changelog
   trunk/scripts/mergechanges.sh
Log:
mergechanges: Merge the Description: fields from each of the supplied
   changes files. Thanks to Vincent Danjean for the patch
   (Closes: #442972)

Modified: trunk/Devscripts/Debbugs.pm
===================================================================
--- trunk/Devscripts/Debbugs.pm 2008-02-26 22:24:05 UTC (rev 1064)
+++ trunk/Devscripts/Debbugs.pm 2008-02-27 00:13:16 UTC (rev 1065)
@@ -288,11 +288,11 @@
 
     my $soap = SOAP::Lite->uri($soapurl)->proxy($soapproxyurl);
 
-    my $binpkg = shift || '';
-    my $binver = shift || '';
-    my $arch = shift || '';
+    my $binpkg = shift;
+    my $binver = shift;
+    my $arch = shift;
 
-    return if not $binpkg or not $binver;
+    return if not defined $binpkg or not defined $binver;
 
     my $mapping = $soap->binary_to_source($binpkg, $binver, $arch)->result();
 
@@ -309,10 +309,10 @@
 
     my $soap = SOAP::Lite->uri($soapurl)->proxy($soapproxyurl);
 
-    my $srcpkg = shift || '';
-    my $srcver = shift || '';
+    my $srcpkg = shift;
+    my $srcver = shift;
 
-    return if not $srcpkg or not $srcver;
+    return if not defined $srcpkg or not defined $srcver;
 
     my $mapping = $soap->source_to_binary($srcpkg, $srcver)->result();
 

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-02-26 22:24:05 UTC (rev 1064)
+++ trunk/debian/changelog      2008-02-27 00:13:16 UTC (rev 1065)
@@ -60,6 +60,9 @@
       (Closes: #467496)
     + Allow package versions to be specified in the package list file
       as package_version (Closes: #467581)
+  * mergechanges: Merge the Description: fields from each of the supplied
+     changes files. Thanks to Vincent Danjean for the patch
+     (Closes: #442972)
 
   [ Christoph Berg ]
   * dget:

Modified: trunk/scripts/mergechanges.sh
===================================================================
--- trunk/scripts/mergechanges.sh       2008-02-26 22:24:05 UTC (rev 1064)
+++ trunk/scripts/mergechanges.sh       2008-02-27 00:13:16 UTC (rev 1065)
@@ -96,6 +96,8 @@
 SOURCE=$(grep -h "^Source: " "$@" | sed -e "s,^Source: ,," | sort -u)
 # Extract & merge the files from all files
 FILES=$(egrep -h "^ [0-9a-f]{32} [0-9]+" "$@" | sort -u)
+# Extract & merge the description from all files
+DESCRIPTIONS=$(sed '/^Description:/,/^[^ ]/{/^ /p;d};d' "$@" | sort -u)
 
 # Sanity check #2: Versions must match
 if test $(echo "${VERSION}" | wc -l) -ne 1; then
@@ -111,6 +113,13 @@
     exit 1
 fi
 
+# Sanity check #4: Description for same binary must match
+if test $(echo "${DESCRIPTIONS}" | sed -e 's/ \+- .*$//' | uniq -d | wc -l) 
-ne 0; then
+    echo "Error: Descriptions do not match:"
+    echo "${DESCRIPTIONS}"
+    exit 1
+fi
+
 if test ${FILE} = 1; then
     DIR=`dirname "$1"`
     REDIR1="> '${DIR}/${SOURCE}_${SVERSION}_multi.changes'"
@@ -119,8 +128,14 @@
 
 # Temporary output
 OUTPUT=`tempfile`
-trap "rm -f '${OUTPUT}'" 0 1 2 3 7 10 13 15
+DESCFILE=`tempfile`
+trap "rm -f '${OUTPUT}' '${DESCFILE}'" 0 1 2 3 7 10 13 15
 
+if test $(echo "${DESCRIPTIONS}" | wc -l) -ne 0; then
+    echo "Description:" > "${DESCFILE}"
+    echo "${DESCRIPTIONS}" >> "${DESCFILE}"
+fi
+
 # Copy one of the files to ${OUTPUT}, nuking any PGP signature
 if $(grep -q "BEGIN PGP SIGNED MESSAGE" "$1"); then
     perl -ne 'next if 1../^$/; next if /^$/..1; print' "$1" > ${OUTPUT}
@@ -128,8 +143,11 @@
     cp "$1" ${OUTPUT}
 fi
 
-# Replace the Architecture: field, and nuke the value of Files:
+# 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},; /^Files: /q' \
+    -e '/^Description:/,/^[^ ]/{/^Description:/d;/^[ ]/d}' \
+    -e '/^Changes:/{r '${DESCFILE} -e ';aChanges:' -e ';d}' \
     ${OUTPUT} ${REDIR1}"
 
 # Voodoo magic to get the merged filelist into the output



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to