From: Frank Lichtenheld Date: Sun, 17 Feb 2008 20:38:51 +0000 (+0100) Subject: Merge commit 'origin/master' into sourcev3 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bface9592c455e3a7bb11c882d74501e2873f4dd;p=dpkg Merge commit 'origin/master' into sourcev3 Conflicts: scripts/dpkg-source.pl --- bface9592c455e3a7bb11c882d74501e2873f4dd diff --cc scripts/dpkg-source.pl index 7d37651f,b63aedba..118098f3 --- a/scripts/dpkg-source.pl +++ b/scripts/dpkg-source.pl @@@ -911,13 -881,22 +917,23 @@@ if ($opmode eq 'build') my @tarfiles; my $difffile; my $debianfile; + my %vcsfiles; my %seen; for my $file (split(/\n /, $files)) { - next if $file eq ''; - $file =~ m/^([0-9a-f]{32})[ \t]+(\d+)[ \t]+([0-9a-zA-Z][-+:.,=0-9a-zA-Z_~]+)$/ - || error(_g("Files field contains bad line `%s'"), $file); - ($md5sum{$3},$size{$3},$file) = ($1,$2,$3); + next if $file eq ''; + $file =~ m/^($check_regex{md5}) # checksum + [ \t]+(\d+) # size + [ \t]+($rx_fname) # filename + $/x + || error(_g("Files field contains bad line `%s'"), $file); + (my $md5sum,$size{$3},$file) = ($1,$2,$3); + if (exists($checksum{$file}{md5}) + and $checksum{$file}{md5} ne $md5sum) { + error(_g("Conflicting checksums \`%s\' and \`%s' for file \`%s'"), + $checksum{$file}{md5}, $md5sum, $file); + } + $checksum{$file}{md5} = $md5sum; + local $_ = $file; error(_g("Files field contains invalid filename `%s'"), $file) @@@ -1364,18 -1645,31 +1369,11 @@@ sub addfile my ($fields, $filename)= @_; $added_files{$filename}++ && internerr(_g("tried to add file `%s' twice"), $filename); - stat($filename) || syserr(_g("could not stat output file `%s'"), $filename); - my $size = (stat _)[7]; - my $md5sum= `md5sum <$filename`; - $? && &subprocerr("md5sum $filename"); - $md5sum = readmd5sum( $md5sum ); - $fields->{'Files'}.= "\n $md5sum $size $filename"; - } - - sub readmd5sum { - (my $md5sum = shift) or return; - $md5sum =~ s/^([0-9a-f]{32})\s*\*?-?\s*\n?$/$1/o - || failure(_g("md5sum gave bogus output `%s'"), $md5sum); - return $md5sum; + my (%sums, $size); + getchecksums($filename, \%sums, \$size); + foreach my $alg (sort keys %sums) { + $fields->{"Checksums-$alg"} .= "\n $sums{$alg} $size $filename"; + } + $fields->{'Files'}.= "\n $sums{md5} $size $filename"; } -# replace \ddd with their corresponding character, refuse \ddd > \377 -# modifies $_ (hs) -{ - my $backslash; -sub deoctify { - my $fn= $_[0]; - $backslash= sprintf("\\%03o", unpack("C", "\\")) if !$backslash; - - s/\\{2}/$backslash/g; - @_= split(/\\/, $fn); - - foreach (@_) { - /^(\d{3})/ or next; - failure(_g("bogus character `\\%s' in `%s'") . "\n", $1, $fn) - if oct($1) > 255; - $_= pack("c", oct($1)) . $POSTMATCH; - } - return join("", @_); -} } -