Author: ryan
Date: 2009-11-16 05:27:35 +0000 (Mon, 16 Nov 2009)
New Revision: 2020

Modified:
   trunk/debian/changelog
   trunk/scripts/mergechanges.sh
Log:
mergechanges: if both input files have the same file listed but with
different checksums, keep the first and get rid of the one from the
second.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2009-11-08 09:19:54 UTC (rev 2019)
+++ trunk/debian/changelog      2009-11-16 05:27:35 UTC (rev 2020)
@@ -24,6 +24,9 @@
   * mk-build-deps: allow passing options to the command in
     MKBUILDDEPS_TOOL. Setting MKBUILDDEPS_TOOL="aptitude --schedule-
     only" in ~/.devscripts should work now. (Closes: #547164)
+  * mergechanges: if both input files have the same file listed but with
+    different checksums, keep the first and get rid of the one from the
+    second.
 
  -- Ryan Niebur <[email protected]>  Sun, 18 Oct 2009 14:31:42 -0700
 

Modified: trunk/scripts/mergechanges.sh
===================================================================
--- trunk/scripts/mergechanges.sh       2009-11-08 09:19:54 UTC (rev 2019)
+++ trunk/scripts/mergechanges.sh       2009-11-16 05:27:35 UTC (rev 2020)
@@ -88,6 +88,10 @@
 # and merge them, sorting out duplicates
 ARCHS=$(grep -h "^Architecture: " "$@" | sed -e "s,^Architecture: ,," | tr ' ' 
'\n' | sort -u | tr '\n' ' ')
 
+checksum_uniq() {
+    awk '{if(arr[$NF] != 1){arr[$NF] = 1; print;}}'
+}
+
 # Extract & merge the Version: field from all files..
 # Don't catch Version: GnuPG lines, though!
 VERSION=$(grep -h "^Version: [0-9]" "$@" | sed -e "s,^Version: ,," | sort -u)
@@ -95,11 +99,11 @@
 # Extract & merge the sources from all files
 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)
+FILES=$(egrep -h "^ [0-9a-f]{32} [0-9]+" "$@" | checksum_uniq)
 # Extract & merge the sha1 checksums from all files
-SHA1S=$(egrep -h "^ [0-9a-f]{40} [0-9]+" "$@" | sort -u)
+SHA1S=$(egrep -h "^ [0-9a-f]{40} [0-9]+" "$@" | checksum_uniq)
 # Extract & merge the sha256 checksums from all files
-SHA256S=$(egrep -h "^ [0-9a-f]{64} [0-9]+" "$@" | sort -u)
+SHA256S=$(egrep -h "^ [0-9a-f]{64} [0-9]+" "$@" | checksum_uniq)
 # Extract & merge the description from all files
 DESCRIPTIONS=$(sed '/^Description:/,/^[^ ]/{/^ /p;d};d' "$@" | sort -u)
 # Extract & merge the Formats from all files



-- 
To unsubscribe, send mail to [email protected].

Reply via email to