tag 474949 + patch thanks On Tue, 08 Apr 2008, Raphael Hertzog wrote: > dpkg >= 1.14.17 generates *.changes files with Format: 1.8. They provide > new Checksums-*: fields which are similar to the Files: field. And debsign > edits in place the Files: field of changes file and leaves the Checksums-* > fields alone.
Here's a patch that fixes the issue. I would highly appreciate if you could upload a fixed package today because it's blocking the upload of dpkg to unstable currently. (And we're tight on schedule with dpkg because of the base freeze and there are many features in this version of dpkg that we really want for lenny). The patch is tested and works fine here. It will generate an error if it doesn't find a Format: 1.7 or 1.8. It will also generate an error if it finds a Checksums-* field that it doesn't know about. Thanks for your help. Cheers, -- Raphaël Hertzog Le best-seller français mis à jour pour Debian Etch : http://www.ouaza.com/livre/admin-debian/
--- /usr/bin/debsign 2008-04-06 18:32:15.000000000 +0200 +++ /home/rhertzog/debsign 2008-04-08 11:43:41.000000000 +0200 @@ -172,6 +172,55 @@ fi } +update_changes_file () { + local changes dsc + changes=$1 + dsc=$2 + + # Only accept to update changes files whose format is known + format=`grep ^Format: $changes | cut -d" " -f 2` + case "$format" in + 1.7|1.8) # Supported + ;; + *) + echo "Changes files ($changes) uses unknown Format: $format." >&2 + exit 1 + ;; + esac + + dsc_md5=`md5sum $dsc | cut -d' ' -f1` + dsc_sha1=`sha1sum $dsc | cut -d' ' -f1` + dsc_sha256=`sha256sum $dsc | cut -d' ' -f1` + echo "$dsc_md5 $dsc_sha1 $dsc_sha256" + + perl -i -pe 'BEGIN { '" + \$dsc_file = \"$dsc\"; + %h=( + 'Sha1' => '$dsc_sha1', + 'Sha256' => '$dsc_sha256', + 'Md5' => '$dsc_md5', + );"' + $dsc_size = (-s $dsc_file); + ($dsc_base = $dsc_file) =~ s|.*/||; + $incsums = ""; + } + /^Files:/i && ($incsums="Md5"); + if (/^Checksums-([^:]+):/i) { + $incsums = ucfirst(lc($1)); + unless ($incsums) { + die "Cannot update changes file using unknown checksum: $1.\n"; + } + } + /^\s*$/ && ($incsums = ""); + if ($incsums && /^ \S+ \d+ (\S+) (\S+) \Q$dsc_base\E\s*$/) { + $_ = " $h{$incsums} $dsc_size $1 $2 $dsc_base\n"; + $incsums = ""; + } elsif ($incsums && /^ \S+ \d+ \Q$dsc_base\E\s*$/) { + $_ = " $h{$incsums} $dsc_size $dsc_base\n"; + $incsums = ""; + } ' "$changes" +} + # --- main script # Boilerplate: set config variables @@ -367,20 +416,8 @@ exit 1 fi check_already_signed "$dsc" "dsc" || withecho signfile "$dsc" "$signas" - dsc_md5=`md5sum $dsc | cut -d' ' -f1` - perl -i -pe 'BEGIN { - '" \$dsc_file=\"$dsc\"; \$dsc_md5=\"$dsc_md5\"; "' - $dsc_size=(-s $dsc_file); ($dsc_base=$dsc_file) =~ s|.*/||; - $infiles=0; - } - /^Files:/ && ($infiles=1); - /^\s*$/ && ($infiles=0); - if ($infiles && - /^ (\S+) (\d+) (\S+) (\S+) \Q$dsc_base\E\s*$/) { - $_ = " $dsc_md5 $dsc_size $3 $4 $dsc_base\n"; - $infiles=0; - }' "$changes" + update_changes_file "$changes" "$dsc" withecho signfile "$changes" "$signas"