diffstat for devscripts-2.9.26 devscripts-2.9.26etch1

 debian/changelog |   13 +++++++++++++
 debsign.sh       |   49 +++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 56 insertions(+), 6 deletions(-)

diff -Nru devscripts-2.9.26/debian/changelog devscripts-2.9.26etch1/debian/changelog
--- devscripts-2.9.26/debian/changelog	2006-11-17 13:03:26.000000000 +0000
+++ devscripts-2.9.26etch1/debian/changelog	2008-12-08 19:06:04.000000000 +0000
@@ -1,3 +1,16 @@
+devscripts (2.9.26etch1) stable; urgency=low
+
+  * debsign: 
+    + Add support for the new Checksums-Sha* .changes file fields
+      introduced by dpkg 1.14.17 (Closes: #474949)
+    + Abort if any unknown Checksums-* fields are found in the .changes
+      file
+    + Abort if the Format field of the .changes file is unsupported
+      (greater than 1.8, less than 1.7 or non-numeric)
+    + Use a case-insensitive search for field names
+
+ -- Adam D. Barratt <adam@adam-barratt.org.uk>  Mon, 08 Dec 2008 18:12:05 +0000
+
 devscripts (2.9.26) unstable; urgency=low
 
   * deb-reversion: update to new upstream version (Closes: #329374)
diff -Nru devscripts-2.9.26/debsign.sh devscripts-2.9.26etch1/debsign.sh
--- devscripts-2.9.26/debsign.sh	2006-02-06 02:06:55.000000000 +0000
+++ devscripts-2.9.26etch1/debsign.sh	2008-12-08 18:11:35.000000000 +0000
@@ -442,20 +442,57 @@
 	fi
 	check_already_signed "$dsc" "dsc" || withecho signfile "$dsc" "$signas"
 	dsc_md5=`md5sum $dsc | cut -d' ' -f1`
+	dsc_sha1=`sha1sum $dsc | cut -d' ' -f1`
+	dsc_sha256=`sha256sum $dsc | cut -d' ' -f1`
 
-	perl -i -pe 'BEGIN {
+	temp_changes="$(mktemp -t debsign.XXXXXX)"
+	cat "$changes" > "$temp_changes"
+	if perl -i -pe 'BEGIN {
 	    '" \$dsc_file=\"$dsc\"; \$dsc_md5=\"$dsc_md5\"; "'
+	    '" \$dsc_sha1=\"$dsc_sha1\"; \$dsc_sha256=\"$dsc_sha256\"; "'
 	    $dsc_size=(-s $dsc_file); ($dsc_base=$dsc_file) =~ s|.*/||;
-	    $infiles=0;
+	    $infiles=0; $insha1=0; $insha256=0; $format="";
 	    }
-	    /^Files:/ && ($infiles=1);
-	    /^\s*$/ && ($infiles=0);
+	    if(/^Format:\s+(.*)/) {
+		$format=$1;
+		die "Unrecognised .changes format: $format\n"
+		    unless $format =~ /^\d+(\.\d+)*$/;
+		($major, $minor) = split(/\./, $format);
+		$major+=0;$minor+=0;
+		die "Unsupported .changes format: $format\n"
+		    if($major!=1 or $minor > 8 or $minor < 7);
+	    }
+	    /^Files:/i && ($infiles=1,$insha1=0,$insha256=0);
+	    if(/^Checksums-Sha1:/i) {$insha1=1;$infiles=0;$insha256=0;}
+	    elsif(/^Checksums-Sha256:/i) {
+		$insha256=1;$infiles=0;$insha1=0;
+	    } elsif(/^Checksums-.*?:/i) {
+		die "Unknown checksum format: $_\n";
+	    }
+	    /^\s*$/ && ($infiles=0,$insha1=0,$insha256=0);
 	    if ($infiles &&
 		/^ (\S+) (\d+) (\S+) (\S+) \Q$dsc_base\E\s*$/) {
 		$_ = " $dsc_md5 $dsc_size $3 $4 $dsc_base\n";
 		$infiles=0;
-	    }' "$changes"
-	    
+	    }
+	    if ($insha1 &&
+		/^ (\S+) (\d+) \Q$dsc_base\E\s*$/) {
+		$_ = " $dsc_sha1 $dsc_size $dsc_base\n";
+		$insha1=0;
+	    }
+	    if ($insha256 &&
+		/^ (\S+) (\d+) \Q$dsc_base\E\s*$/) {
+		$_ = " $dsc_sha256 $dsc_size $dsc_base\n";
+		$insha256=0;
+	    }' "$temp_changes"
+	    then
+		mv -f -- "$temp_changes" "$changes"
+	    else
+		rm "$temp_changes"
+		echo "$PROGNAME: Error processing .changes file (see above)" >&2
+		exit 1
+	    fi
+
 	withecho signfile "$changes" "$signas"
 	
 	if [ -n "$remotehost" ]
