Kaynağa Gözat

Merge commit 'origin/master' into sourcev3

Conflicts:

	scripts/dpkg-source.pl
Frank Lichtenheld 18 yıl önce
ebeveyn
işleme
bface9592c

+ 29 - 0
ChangeLog

@@ -1,3 +1,24 @@
+2008-02-17  Frank Lichtenheld  <djpig@debian.org>
+
+	* scripts/Dpkg.pm: Allow overriding $pkgdatadir
+	with $ENV{DPKG_DATADIR}.
+	* scripts/Makefile.am (check): Use DPKG_DATADIR.
+	* debian/rules: Remove hack to copy data files
+	to build directory.
+
+
+2008-02-17  Frank Lichtenheld  <djpig@debian.org>
+	    Matthias Klose  <doko@cs.tu-berlin.de>
+
+	* scripts/dpkg-buildpackage.pl: Set a set of environment variables
+	for setting compiler and linker options, unless already set in the
+	environment. See https://wiki.ubuntu.com/DistCompilerFlags for
+	background information.
+
+2008-02-13  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/Dpkg/Version.pm: Import Dpkg::Gettext since we use _g().
+
 2008-02-07  Guillem Jover  <guillem@debian.org>
 
 	* scripts/dpkg-gencontrol.pl: Do not output the Homepage field on udeb.
@@ -110,6 +131,14 @@
 	used.
 	* scripts/t/200_Dpkg_Shlibs.t: Adjust test suite to API change.
 
+2008-01-26  Frank Lichtenheld  <djpig@debian.org>
+
+	* scripts/Dpkg/Checksums.pm: New module for checksum handling
+	in .changes and .dsc files.
+	* scripts/dpkg-genchanges.pl, scripts/dpkg-source.pl: Use new
+	module. Adds new 'Checksums-{Sha1,Sha256}' field
+	to .changes and .dsc files. Increase changes format to 1.8.
+
 2008-01-25  Andreas Påhlsson  <andreas.pahlsson@xcerion.com>
 
 	* utils/start-stop-daemon.c (tsub): Remove function.

+ 12 - 0
debian/changelog

@@ -15,6 +15,8 @@ dpkg (1.14.17) UNRELEASED; urgency=low
     Christian Perrier with their permission.
   * Use functions from libcompat when those are not provided by the system.
   * Change dpkg-gencontrol to not output the Homapage field on udeb.
+  * Reintroduce 'no-debsig' back in dpkg.cfg to avoid failing to install any
+    package when debsig-verify is installed. Closes: #311843
 
   [ Raphael Hertzog ]
   * Add a warning displayed by dpkg-genchanges if the current version is
@@ -31,11 +33,21 @@ dpkg (1.14.17) UNRELEASED; urgency=low
     about.
   * Handle the case when the library has a different SONAME than the one used
     to find it. Closes: #462413
+  * Fix Dpkg::Version to import _g() from Dpkg::Gettext. Thanks to Adam Heath
+    for spotting this. Closes: #465651
 
   [ Frank Lichtenheld ]
   * Add a warning in dpkg-buildpackage if the build-dependencies are not
     satisfied during -S. Closes: #445552
   * Add a missing space in the German scripts translation. Closes: #463398
+  * Add improved deb-shlibs.5 manual page by Zack Weinberg. Closes: #466135
+  * dpkg-buildpackage exports some build related environment variables
+    now. Based on a patch by Matthias Klose. Closes: #465282
+    (See dpkg-buildpackage(1) and https://wiki.ubuntu.com/DistCompilerFlags
+     for details)
+  * Add support for use of SHA1 and SHA256 checksums in .dsc and
+    .changes files. Information will be available in Checksums-Sha{1,256}
+    fields. .changes format version increased to 1.8.
 
   [ Updated dpkg translations ]
   * Korean (Changwoo Ryu).

+ 1 - 0
debian/dpkg-dev.install

@@ -64,6 +64,7 @@ usr/share/man/*/dpkg-source.1
 usr/share/perl5/Dpkg/Arch.pm
 usr/share/perl5/Dpkg/BuildOptions.pm
 usr/share/perl5/Dpkg/Cdata.pm
+usr/share/perl5/Dpkg/Checksums.pm
 usr/share/perl5/Dpkg/Compression.pm
 usr/share/perl5/Dpkg/Control.pm
 usr/share/perl5/Dpkg/Changelog.pm

+ 4 - 0
debian/dpkg.cfg

@@ -5,5 +5,9 @@
 # the option, separated by whitespace and/or an `=' sign.
 #
 
+# Do not enable debsig-verify by default; since the distribution is not using
+# embedded signatures, debsig-verify would reject all packages.
+no-debsig
+
 # Log status changes and actions to a file.
 log /var/log/dpkg.log

+ 0 - 1
debian/rules

@@ -55,7 +55,6 @@ build-tree/config.status: configure
 		--localstatedir=/var/lib \
 		--with-zlib=static \
 		--with-bz2=static
-	cp cputable ostable triplettable build-tree/
 
 # Build the package in build-tree
 build: build-tree/config.status

+ 19 - 0
man/ChangeLog

@@ -1,3 +1,22 @@
+2008-02-17  Frank Lichtenheld  <djpig@debian.org>
+
+	* dpkg-architecture.1: Document the files
+	needed by dpkg-architecture.
+
+	* po/dpkg-man.pot: Regenerated.
+	* po/*.po: Merged with dpkg-man.pot.
+
+2008-02-17  Frank Lichtenheld  <djpig@debian.org>
+	    Matthias Klose  <doko@cs.tu-berlin.de>
+
+	* man/dpkg-buildpackage.1: Document the new
+	behaviour for build related environment variables.
+
+2008-02-17  Zack Weinberg  <zackw@panix.com>
+
+	* deb-shlibs.5: Make this manual page a bit
+	more elaborate and helpful.
+
 2008-01-22  Peter Karlsson  <peterk@debian.org>
 
 	* po/sv.po: Updated to 1422t.

+ 43 - 9
man/deb-shlibs.5

@@ -1,4 +1,5 @@
-.\" This manpage is copyright (C) 1996 Michael Shields <shields@crosslink.net>.
+.\" Copyright (C) 1996 Michael Shields <shields@crosslink.net>
+.\" Copyright (C) 2008 Zack Weinberg <zackw@panix.com>
 .\" 
 .\" This is free software; you may redistribute it and/or modify
 .\" it under the terms of the GNU General Public License as
@@ -13,18 +14,51 @@
 .\" You should have received a copy of the GNU General Public
 .\" License along with dpkg; if not, write to the Free Software
 .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-.TH deb\-shlibs 5 "2007-03-08" "Debian Project" "dpkg utilities"
+.TH deb\-shlibs 5 "2008-02-17" "Debian Project" "dpkg utilities"
 .SH NAME
 deb\-shlibs \- Debian shared library information file
 .
-.SH SYNOPSIS
-shlibs
-.
 .SH DESCRIPTION
-The format for a shared library dependency information entry in these
-files is (see the Debian Policy Manual for details):
 .PP
-<library name>        <version/soname>        <dependencies>
+.B shlibs
+files map shared library names and versions
+.RI ( sonames )
+to dependencies suitable for a package control file.  There is one
+entry per line. Blank lines are \fBnot\fP allowed.  Lines beginning
+with an \fB#\fP character are considered commentary, and are ignored.
+All other lines must have the format
+.IP
+.RI [ tag: ]
+.I library
+.I version
+.I dependencies
+.PP
+The \fIlibrary\fP and \fIversion\fP fields are whitespace-delimited,
+but the \fIdependencies\fP field extends to the end of the line.  The
+\fItag\fP field is optional and normally not needed.
+.PP
+See the Debian Policy Manual for further details.
+.
+.SH EXAMPLES
+.PP
+The
+.B shlibs
+file for a typical library package, named 
+.IR libcrunch1 ,
+that provides one library whose soname is
+.IR libcrunch.so.1 ,
+might read
+.IP
+libcrunch 1 libcrunch1 (>= 1.2-1)
+.PP
+The \fIdependencies\fP
+must mention the most recent version of the package that added new
+symbols to the library: in the above example, new symbols were added to
+version 1.2 of
+.IR libcrunch .
+This is not the only reason the dependencies might need to be
+tightened; again, see the Debian Policy Manual for details.
 .
 .SH SEE ALSO
-.BR dpkg\-shlibdeps (1).
+.BR dpkg\-shlibdeps (1),
+.BR deb\-symbols (5).

+ 15 - 0
man/dpkg-architecture.1

@@ -265,6 +265,21 @@ dpkg\-architecture \-ilinux\-any
 .IP
 dpkg\-architecture \-ai386 \-ilinux\-any
 .
+.SH FILES
+All these files have to be present for \fBdpkg-architecture\fP to
+work. Their location can be overriden at runtime with the environment
+variable DPKG_DATADIR.
+.TP
+.I /usr/share/dpkg/cputable
+Table of known CPU names and mapping to their GNU name.
+.TP
+.I /usr/share/dpkg/ostable
+Table of known operating system names and mapping to their GNU name.
+.TP
+.I /usr/share/dpkg/triplettable
+Mapping between Debian architecture triplets and Debian architecture
+names.
+.
 .SH "SEE ALSO"
 .BR dpkg\-buildpackage (1),
 .BR dpkg\-cross (1).

+ 71 - 0
man/dpkg-buildpackage.1

@@ -204,6 +204,77 @@ Show the usage message and exit.
 .BR \-\-version
 Show the version and exit.
 .
+.SH ENVIRONMENT
+A set of environment variables for setting compiler and linker options are
+set to default values unless already set in the environment. Note that
+this mechanism was only introduced in dpkg-dev, version 1.14.17 and
+not all \fIrules\fP files and build tools will honour these variables,
+yet.
+.TP
+.B CFLAGS
+Optimization options which are passed to the debian build system and
+can/should be overriden by the package build if needed (default value:
+.BR \-g\ \-O2
+, or
+.BR \-g\ \-O0
+if
+.BR noopt
+is specified in DEB_BUILD_OPTIONS). Overriding options can be
+used to explicitely set a
+higher optimization level, or work around compiler bugs, which only
+can be seen with some optimization levels (the last opt level "wins").
+.TP
+.B CFLAGS_APPEND
+Optimization options appended to the compiler flags, which must not be
+overwritten by the package (mostly used to for test builds). Default
+value: empty.
+.TP
+.B CXXFLAGS
+Same as
+.B CFLAGS
+for C++ sources.
+.TP
+.B CXXFLAGS_APPEND
+Same as
+.B CFLAGS_APPEND
+for C++ sources.
+.TP
+.B FFLAGS
+Same as
+.B FFLAGS
+for Fortran sources.
+.TP
+.B FFLAGS_APPEND
+Same as
+.B CFLAGS_APPEND
+for Fortran sources.
+.TP
+.B CPPFLAGS
+Preprocessor flags which are passed to the debian build system and
+can/should be overriden by the package build if needed (default:
+empty). This macro is seldom used (most build systems just use
+.B CFLAGS
+instead of
+.B CPPFLAGS).
+.TP
+.B CPPFLAGS_APPEND
+Preprocessor flags appended to the preprocessor flags, which must not
+be overwritten by the package (mostly used to for test
+builds). Default value: empty.
+.TP
+.B LDFLAGS
+Options passed to the compiler when linking executables or shared
+objects (if the linker is called directly, then
+.B -Wl
+and
+.B ,
+have to be stripped from these options. Default value: empty.
+.TP
+.B LDFLAGS_APPEND
+Optimization options appended to the compiler flags when linking code,
+which must not be overwritten by the package (mostly used to for test
+builds). Default value: empty.
+.
 .SH BUGS
 It should be possible to specify spaces and shell metacharacters in
 and initial arguments for

Dosya farkı çok büyük olduğundan ihmal edildi
+ 481 - 176
man/po/de.po


Dosya farkı çok büyük olduğundan ihmal edildi
+ 416 - 134
man/po/dpkg-man.pot


Dosya farkı çok büyük olduğundan ihmal edildi
+ 426 - 150
man/po/es.po


Dosya farkı çok büyük olduğundan ihmal edildi
+ 463 - 160
man/po/fr.po


Dosya farkı çok büyük olduğundan ihmal edildi
+ 436 - 150
man/po/hu.po


Dosya farkı çok büyük olduğundan ihmal edildi
+ 440 - 150
man/po/ja.po


Dosya farkı çok büyük olduğundan ihmal edildi
+ 462 - 159
man/po/pl.po


Dosya farkı çok büyük olduğundan ihmal edildi
+ 436 - 150
man/po/pt_BR.po


Dosya farkı çok büyük olduğundan ihmal edildi
+ 437 - 150
man/po/ru.po


Dosya farkı çok büyük olduğundan ihmal edildi
+ 492 - 189
man/po/sv.po


+ 1 - 0
scripts/Dpkg.pm

@@ -19,5 +19,6 @@ our $version = "1.14";
 our $admindir = "/var/lib/dpkg";
 our $dpkglibdir = ".";
 our $pkgdatadir = "..";
+$pkgdatadir = $ENV{DPKG_DATADIR} if defined $ENV{DPKG_DATADIR};
 
 1;

+ 105 - 0
scripts/Dpkg/Checksums.pm

@@ -0,0 +1,105 @@
+package Dpkg::Checksums;
+
+use strict;
+use warnings;
+
+use Dpkg;
+use Dpkg::Gettext;
+use Dpkg::ErrorHandling qw(internerr syserr subprocerr failure error
+                           warning );
+
+use base qw(Exporter);
+our @EXPORT = qw(@check_supported %check_supported %check_prog %check_regex
+                 readchecksums readallchecksums getchecksums);
+
+our @check_supported = qw(md5 sha1 sha256);
+our %check_supported = map { $_ => 1 } @check_supported;
+our %check_prog = ( md5 => 'md5sum', sha1 => 'sha1sum',
+		    sha256 => 'sha256sum' );
+our %check_regex = ( md5 => qr/[0-9a-f]{32}/,
+		     sha1 => qr/[0-9a-f]{40}/,
+		     sha256 => qr/[0-9a-f]{64}/ );
+
+sub extractchecksum {
+    my ($alg, $checksum) = @_;
+    ($checksum =~ /^($check_regex{$alg})(\s|$)/m)
+	|| failure(_g("checksum program gave bogus output `%s'"), $checksum);
+    return $1;
+}
+
+
+sub readchecksums {
+    my ($alg, $fieldtext, $checksums, $sizes) = @_;
+    my %checksums;
+
+    $alg = lc($alg);
+    unless ($check_supported{$alg}) {
+	warning(_g("Unknown checksum algorithm \`%s', ignoring"), $alg);
+	return;
+    }
+    my $rx_fname = qr/[0-9a-zA-Z][-+:.,=0-9a-zA-Z_~]+/;
+    for my $checksum (split /\n /, $fieldtext) {
+	next if $checksum eq '';
+	$checksum =~ m/^($check_regex{$alg})\s+(\d+)\s+($rx_fname)$/
+	    || do {
+		warning(_g("Checksums-%s field contains bad line \`%s'"),
+			ucfirst($alg), $checksum);
+		next;
+	};
+	my ($sum, $size, $file) = ($1, $2, $3);
+	if (exists($checksums->{$file}{$alg})
+	    and $checksums->{$file}{$alg} ne $sum) {
+	    error(_g("Conflicting checksums \`%s\' and \`%s' for file \`%s'"),
+		  $checksums->{$file}{$alg}, $sum, $file);
+	}
+	if (exists($sizes->{$file})
+	    and $sizes->{$file} != $size) {
+	    error(_g("Conflicting file sizes \`%u\' and \`%u' for file \`%s'"),
+		  $sizes->{$file}, $size, $file);
+	}
+	$checksums->{$file}{$alg} = $sum;
+	$sizes->{$file} = $size;
+    }
+
+    return 1;
+}
+
+sub readallchecksums {
+    my ($fields, $checksums, $sizes) = @_;
+
+    foreach my $field (keys %$fields) {
+	if ($field =~ /^Checksums-(\w+)$/
+	    && defined($fields->{$field})) {
+	    readchecksums($1, $fields->{$field}, $checksums, $sizes);
+	}
+    }
+}
+
+sub getchecksums {
+    my ($file, $checksums, $size) = @_;
+
+    (my @s = stat($file)) || syserr(_g("cannot fstat file %s"), $file);
+    my $newsize = $s[7];
+    if (defined($$size)
+	and $newsize != $$size) {
+	error(_g("File %s has size %u instead of expected %u"),
+	      $file, $newsize, $$size);
+    }
+    $$size = $newsize;
+
+    foreach my $alg (@check_supported) {
+	my $prog = $check_prog{$alg};
+	my $newsum = `$prog $file`;
+	$? && subprocerr("%s %s", $prog, $file);
+	$newsum = extractchecksum($alg, $newsum);
+
+	if (defined($checksums->{$alg})
+	    and $newsum ne $checksums->{$alg}) {
+	    error(_g("File %s has checksum %s instead of expected %s (algorithm %s)"),
+		  $file, $newsum, $checksums->{$alg}, $alg);
+	}
+	$checksums->{$alg} = $newsum;
+    }
+}
+
+1;

+ 1 - 0
scripts/Dpkg/Version.pm

@@ -22,6 +22,7 @@ use strict;
 use warnings;
 
 use Dpkg::ErrorHandling qw(error);
+use Dpkg::Gettext;
 
 use Exporter;
 our @ISA = qw(Exporter);

+ 2 - 1
scripts/Makefile.am

@@ -90,6 +90,7 @@ nobase_dist_perllib_DATA = \
 	Dpkg/Cdata.pm \
 	Dpkg/Changelog.pm \
 	Dpkg/Changelog/Debian.pm \
+	Dpkg/Checksums.pm \
 	Dpkg/Compression.pm \
 	Dpkg/Control.pm \
 	Dpkg/Deps.pm \
@@ -167,4 +168,4 @@ check: $(TEST_FILES) $(wildcard $(srcdir)/t/200_Dpkg_Shlibs/ld.so.conf*)
 # a bit hacky...
 	$(mkdir_p) t.tmp
 	cp -dRl $(srcdir)/t/200_Dpkg_Shlibs/ld.so.conf* t.tmp/
-	srcdir=$(srcdir) PERL5LIB=$(srcdir) PERL_DL_NONLAZY=1 $(PERL) -I$(srcdir) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '.')" $(TEST_FILES)
+	srcdir=$(srcdir) PERL5LIB=$(srcdir) DPKG_DATADIR=$(srcdir)/.. PERL_DL_NONLAZY=1 $(PERL) -I$(srcdir) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '.')" $(TEST_FILES)

+ 23 - 2
scripts/dpkg-buildpackage.pl

@@ -242,9 +242,8 @@ if ($signcommand) {
     }
 }
 
+my $build_opts = Dpkg::BuildOptions::parse();
 if ($parallel) {
-    my $build_opts = Dpkg::BuildOptions::parse();
-
     $parallel = $build_opts->{parallel} if (defined $build_opts->{parallel});
     $ENV{MAKEFLAGS} ||= '';
     if ($parallel eq '-1') {
@@ -256,6 +255,28 @@ if ($parallel) {
     Dpkg::BuildOptions::set($build_opts);
 }
 
+my $default_flags = defined $build_opts->{noopt} ? "-g -O0" : "-g -O2";
+my %flags = ( CPPFLAGS => '',
+	      CFLAGS   => $default_flags,
+	      CXXFLAGS => $default_flags,
+	      FFLAGS   => $default_flags,
+	      LDFLAGS  => "-Wl,-Bsymbolic-functions",
+    );
+
+foreach my $flag (keys %flags) {
+    if ($ENV{$flag}) {
+	printf(_g("%s: use %s from environment: %s\n"), $progname,
+		  $flag, $ENV{$flag});
+    } else {
+	$ENV{$flag} = $flags{$flag};
+	printf(_g("%s: set %s to default value: %s\n"), $progname,
+		  $flag, $ENV{$flag});
+    }
+    if ($ENV{"${flag}_APPEND"}) {
+	$ENV{$flag} .= " ".$ENV{"${flag}_APPEND"};
+    }
+}
+
 my $cwd = cwd();
 my $dir = basename($cwd);
 

+ 33 - 22
scripts/dpkg-genchanges.pl

@@ -8,6 +8,7 @@ use POSIX qw(:errno_h :signal_h);
 use English;
 use Dpkg;
 use Dpkg::Gettext;
+use Dpkg::Checksums;
 use Dpkg::ErrorHandling qw(warning error failure unknown internerr syserr
                            subprocerr usageerr);
 use Dpkg::Arch qw(get_host_arch debarch_eq debarch_is);
@@ -35,7 +36,7 @@ my $uploadfilesdir = '..';
 my $sourcestyle = 'i';
 my $quiet = 0;
 my $host_arch = get_host_arch();
-my $changes_format = "1.7";
+my $changes_format = "1.8";
 
 my %f2p;           # - file to package map
 my %p2f;           # - package to file map, has entries for "packagename"
@@ -53,7 +54,8 @@ my @descriptions;
 my @sourcefiles;
 my @fileslistfiles;
 
-my %md5sum;        # - md5sum to file map
+my %checksum;      # - file to checksum map
+my %size;          # - file to size map
 my %remove;        # - fields to remove
 my %override;
 my %archadded;
@@ -400,12 +402,27 @@ if (!is_binaryonly) {
     my $dsc_fields = parsecdata(\*CDATA, sprintf(_g("source control file %s"), $dsc),
 				allow_pgp => 1);
 
+    readallchecksums($dsc_fields, \%checksum, \%size);
+
+    my $rx_fname = qr/[0-9a-zA-Z][-+:.,=0-9a-zA-Z_~]+/;
     my $files = $dsc_fields->{'Files'};
-    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{$2},$file) = ($1,$2);
+    for my $line (split(/\n /, $files)) {
+	next if $line eq '';
+	$line =~ m/^($check_regex{md5})[ \t]+(\d+)[ \t]+($rx_fname)$/
+	    || error(_g("Files field contains bad line \`%s'"), $line);
+	my ($md5sum,$size,$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);
+	}
+	if (exists($size{$file})
+	    and $size{$file} != $size) {
+	    error(_g("Conflicting sizes \`%u\' and \`%u' for file \`%s'"),
+		  $size{$file}, $size, $file);
+	}
+	$checksum{$file}{md5} = $md5sum;
+	$size{$file} = $size;
         push(@sourcefiles,$file);
     }
     for my $f (@sourcefiles) {
@@ -477,23 +494,17 @@ for my $f (@sourcefiles, @fileslistfiles) {
     next if ($include == ARCH_INDEP and not debarch_eq('all', $p2arch{$f2p{$f}}));
     next if $filedone{$f}++;
     my $uf = "$uploadfilesdir/$f";
-    open(STDIN, "<", $uf) ||
-	syserr(_g("cannot open upload file %s for reading"), $uf);
-    (my @s = stat(STDIN)) || syserr(_g("cannot fstat upload file %s"), $uf);
-    my $size = $s[7];
-    $size || warning(_g("upload file %s is empty"), $uf);
-    my $md5sum = `md5sum`;
-    $? && subprocerr(_g("md5sum upload file %s"), $uf);
-    $md5sum =~ m/^([0-9a-f]{32})\s*-?\s*$/i ||
-        failure(_g("md5sum upload file %s gave strange output \`%s'"),
-                $uf, $md5sum);
-    $md5sum= $1;
-    defined($md5sum{$f}) && $md5sum{$f} ne $md5sum &&
-        error(_g("md5sum of source file %s (%s) is different from md5sum " .
-                 "in %s (%s)"), $uf, $md5sum, $dsc, $md5sum{$f});
-    $fields->{'Files'}.= "\n $md5sum $size $f2sec{$f} $f2pri{$f} $f";
+    $checksum{$f} ||= {};
+    getchecksums($uf, $checksum{$f}, \$size{$f});
+    foreach my $alg (sort keys %{$checksum{$f}}) {
+	$fields->{"Checksums-$alg"} .= "\n $checksum{$f}{$alg} $size{$f} $f";
+    }
+    $fields->{'Files'} .= "\n $checksum{$f}{md5} $size{$f} $f2sec{$f} $f2pri{$f} $f";
 }
 
+# redundant with the Files field
+delete $fields->{"Checksums-Md5"};
+
 $fields->{'Source'}= $sourcepackage;
 if ($fields->{'Version'} ne $substvars->get('source:Version')) {
     $fields->{'Source'} .= " (" . $substvars->get('source:Version') . ")";

+ 31 - 33
scripts/dpkg-source.pl

@@ -5,6 +5,7 @@ use warnings;
 
 use Dpkg;
 use Dpkg::Gettext;
+use Dpkg::Checksums;
 use Dpkg::ErrorHandling qw(warning warnerror error failure unknown
                            internerr syserr subprocerr usageerr
                            $warnable_error $quiet_warnings);
@@ -100,7 +101,7 @@ my %remove;
 my %override;
 
 # Files
-my %md5sum;
+my %checksum;
 my %size;
 my %type;		 # used by checktype
 my %filepatched;	 # used by checkdiff
@@ -122,7 +123,8 @@ my @dsc_fields = (qw(Format Source Binary Architecture Version Origin
 		     Maintainer Uploaders Dm-Upload-Allowed Homepage
 		     Standards-Version Vcs-Browser Vcs-Arch Vcs-Bzr
 		     Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg Vcs-Mtn Vcs-Svn),
-                  @src_dep_fields);
+                  @src_dep_fields,
+                  qw(Files));
 
 
 # Make sure patch doesn't get any funny ideas
@@ -198,7 +200,7 @@ General options:
 "), $progname,
     $diff_ignore_default_regexp,
     join('', map { " -I$_" } @tar_ignore_default_pattern),
-    "@comp_supported" ;
+    "@comp_supported";
 }
 
 sub handleformat {
@@ -808,6 +810,7 @@ if ($opmode eq 'build') {
     open(DSC, ">", "$basenamerev.dsc") ||
         syserr(_g("create %s"), "$basenamerev.dsc");
 
+    delete $fields->{'Checksums-Md5'}; # identical with Files field
     $substvars->parse($varlistfile) if $varlistfile && -e $varlistfile;
     tied(%{$fields})->set_field_importance(@dsc_fields);
     tied(%{$fields})->output(\*DSC, $substvars);
@@ -907,6 +910,9 @@ if ($opmode eq 'build') {
         $baseversion= $version; $revision= '';
     }
 
+    readallchecksums($fields, \%checksum, \%size);
+
+    my $rx_fname = qr/[0-9a-zA-Z][-+:.,=0-9a-zA-Z_~]+/;
     my $files = $fields->{'Files'};
     my @tarfiles;
     my $difffile;
@@ -914,10 +920,20 @@ if ($opmode eq 'build') {
     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)
@@ -1176,19 +1192,8 @@ if ($opmode eq 'build') {
 }
 
 sub checkstats {
-    my $dscdir = shift;
-    my ($f) = @_;
-    my @s;
-    my $m;
-    open(STDIN, "<", "$dscdir/$f") || syserr(_g("cannot read %s"), "$dscdir/$f");
-    (@s = stat(STDIN)) || syserr(_g("cannot fstat %s"), "$dscdir/$f");
-    $s[7] == $size{$f} || error(_g("file %s has size %s instead of expected %s"),
-                                $f, $s[7], $size{$f});
-    $m= `md5sum`; $? && subprocerr("md5sum $f"); $m =~ s/\n$//;
-    $m = readmd5sum( $m );
-    $m eq $md5sum{$f} || error(_g("file %s has md5sum %s instead of expected %s"),
-                               $f, $m, $md5sum{$f});
-    open(STDIN, "<", "/dev/null") || &syserr(_g("reopen stdin from /dev/null"));
+    my ($dscdir, $f) = @_;
+    getchecksums("$dscdir/$f", $checksum{$f}, \$size{$f});
 }
 
 sub erasedir {
@@ -1364,18 +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";
 }
 

+ 4 - 0
scripts/po/ChangeLog

@@ -1,3 +1,7 @@
+2008-01-22  Helge Kreutzmann  <debian@helgefjell.de>
+
+	* de.po: Updated to 335t0f148u.
+
 2008-01-28  Raphael Hertzog  <hertzog@debian.org>
 
 	* *.po: Avoid fuzzy translations on a cosmetic string change.

+ 1 - 0
scripts/po/POTFILES.in

@@ -18,6 +18,7 @@ scripts/Dpkg/Arch.pm
 scripts/Dpkg/Cdata.pm
 scripts/Dpkg/Changelog.pm
 scripts/Dpkg/Changelog/Debian.pm
+scripts/Dpkg/Checksums.pm
 scripts/Dpkg/Control.pm
 scripts/Dpkg/Deps.pm
 scripts/Dpkg/ErrorHandling.pm

+ 43 - 19
scripts/po/de.po

@@ -7,7 +7,7 @@ msgstr ""
 "Project-Id-Version: dpkg scripts\n"
 "Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
 "POT-Creation-Date: 2008-01-21 08:25+0200\n"
-"PO-Revision-Date: 2008-01-27 01:37+0100\n"
+"PO-Revision-Date: 2008-02-16 17:08+0100\n"
 "Last-Translator: Helge Kreutzmann <debian@helgefjell.de>\n"
 "Language-Team: de <debian-l10n-german@lists.debian.org>\n"
 "MIME-Version: 1.0\n"
@@ -1085,6 +1085,8 @@ msgid ""
 " ! Package %s (filename %s) is repeat but newer version;\n"
 "   used that one and ignored data from %s !\n"
 msgstr ""
+" ! Paket %s (Dateiname %s) ist wiederholt aber neuere Version;\n"
+"   verwendete dieses und ignorierte Daten aus %s !\n"
 
 #: scripts/dpkg-scanpackages.pl:196
 #, perl-format
@@ -1129,7 +1131,7 @@ msgstr "** Paket ist im Archiv, aber fehlt in Override-Datei: **"
 
 #: scripts/dpkg-scanpackages.pl:274
 msgid " ++ Packages in override file with incorrect old maintainer value: ++"
-msgstr ""
+msgstr " ++ Pakete in Override-Datei mit ungültigen alten Betreuer-Wert: ++"
 
 #: scripts/dpkg-scanpackages.pl:280
 msgid " -- Packages specifying same maintainer as override file: --"
@@ -1162,6 +1164,21 @@ msgid ""
 "\n"
 "See the man page for the full documentation.\n"
 msgstr ""
+"Verwendung: %s [<Option> ...] <Binärpfad> [<Override-Date> [<Pfadpräfix>]] > "
+"Quellen\n"
+"\n"
+"Optionen:\n"
+"  -n, --no-sort            sortiere vor Ausgabe nicht nach Paketen.\n"
+"  -s, --source-override <Datei>\n"
+"                           verwende Datei für zusätzliche Quell-Overrides, "
+"standardmäßig\n"
+"                           wird an eine reguläre Override-Datei ».src«\n"
+"                           angehängt.\n"
+"      --debug              Debugging einschalten.\n"
+"      --help               zeige diese Hilfemeldung.\n"
+"      --version            zeige die Version.\n"
+"\n"
+"Lesen Sie die Handbuchseite für die komplette Dokumentation.\n"
 
 #: scripts/dpkg-scansources.pl:142
 #, perl-format
@@ -1238,7 +1255,7 @@ msgstr "kann keinen Fork durchf
 #: scripts/dpkg-scansources.pl:299
 #, perl-format
 msgid "can't dup %s:"
-msgstr ""
+msgstr "kann dup von %s nicht ausführen:"
 
 #: scripts/dpkg-scansources.pl:300
 #, perl-format
@@ -1560,7 +1577,7 @@ msgstr "ben
 #: scripts/dpkg-source.pl:281
 #, perl-format
 msgid "source handling style -s%s not allowed with -b"
-msgstr ""
+msgstr "Bearbeitungsstil der Quellen -s%s nicht mit -b erlaubt"
 
 #: scripts/dpkg-source.pl:284
 msgid "-b needs a directory"
@@ -1568,7 +1585,7 @@ msgstr "-b ben
 
 #: scripts/dpkg-source.pl:285
 msgid "-b takes at most a directory and an orig source argument"
-msgstr ""
+msgstr "-b nimmt höchstens ein Verzeichnis und eine Originalqulle als Argument"
 
 #: scripts/dpkg-source.pl:288
 #, perl-format
@@ -1633,7 +1650,7 @@ msgstr ""
 #: scripts/dpkg-source.pl:480
 #, perl-format
 msgid "unpacked orig `%s' exists but is not a directory"
-msgstr ""
+msgstr "entpacktes Original »%s« existiert ist aber kein Verzeichnis"
 
 #: scripts/dpkg-source.pl:484
 #, perl-format
@@ -1649,6 +1666,7 @@ msgstr "Quellverzeichnis 
 #, perl-format
 msgid ".orig directory name %s is not <package>-<upstreamversion> (wanted %s)"
 msgstr ""
+".orig-Verzeichnisname %s ist nicht <Paket>-<Ursprungsversion> (erwünscht %s)"
 
 #: scripts/dpkg-source.pl:519
 #, perl-format
@@ -1663,6 +1681,8 @@ msgid ""
 "tarfile `%s' already exists, not overwriting, giving up; use -sU or -sR to "
 "override"
 msgstr ""
+"Tardaatei »%s« existiert bereits, überschreibe nicht und gebe auf; verwenden "
+"Sie -sU oder -sR zum Erzwingen"
 
 #: scripts/dpkg-source.pl:535
 #, perl-format
@@ -1686,7 +1706,7 @@ msgstr "Fork f
 #: scripts/dpkg-source.pl:547
 #, perl-format
 msgid "chdir to above (orig) source %s"
-msgstr ""
+msgstr "Chdir zu obigen (original-)Quellen %s"
 
 #: scripts/dpkg-source.pl:548
 msgid "reopen gzip for tar"
@@ -1725,11 +1745,13 @@ msgid ""
 "orig dir `%s' already exists, not overwriting, giving up; use -sA, -sK or -"
 "sP to override"
 msgstr ""
+"Originalverzeichnis »%s« existiert bereits, überschreibe nicht und gebe auf; "
+"verwenden Sie -sA, -sK oder -sP zum Erzwingen."
 
 #: scripts/dpkg-source.pl:583
 #, perl-format
 msgid "unable to check for existence of orig dir `%s'"
-msgstr ""
+msgstr "kann die Existenz des Originalverzeichnisses »%s« nicht überprüfen"
 
 #: scripts/dpkg-source.pl:593 scripts/dpkg-source.pl:956
 #, perl-format
@@ -1753,7 +1775,7 @@ msgstr ""
 
 #: scripts/dpkg-source.pl:615
 msgid "fork for find"
-msgstr ""
+msgstr "Fork für Find"
 
 #: scripts/dpkg-source.pl:617
 #, perl-format
@@ -1777,32 +1799,32 @@ msgstr "kann Link %s nicht lesen"
 #: scripts/dpkg-source.pl:636
 #, perl-format
 msgid "cannot read orig link %s"
-msgstr ""
+msgstr "kann Originallink %s nicht lesen"
 
 #: scripts/dpkg-source.pl:637 scripts/dpkg-source.pl:638
 #, perl-format
 msgid "symlink to %s"
-msgstr ""
+msgstr "Symlink auf %s"
 
 #: scripts/dpkg-source.pl:645 scripts/dpkg-source.pl:716
 #, perl-format
 msgid "cannot stat orig file %s"
-msgstr ""
+msgstr "kann Stat auf Originaldatei %s nicht durchführen"
 
 #: scripts/dpkg-source.pl:648
 #, perl-format
 msgid "newly created empty file '%s' will not be represented in diff"
-msgstr ""
+msgstr "neu-erstellte leere Datei »%s« wird im Diff nicht dargestellt werden"
 
 #: scripts/dpkg-source.pl:652
 #, perl-format
 msgid "executable mode %04o of '%s' will not be represented in diff"
-msgstr ""
+msgstr "ausführbarer Modus %04o von »%s« wird nicht im Diff dargestellt werden"
 
 #: scripts/dpkg-source.pl:657
 #, perl-format
 msgid "special mode %04o of '%s' will not be represented in diff"
-msgstr ""
+msgstr "besonderer Modus %04o von »%s« wird nicht im Diff dargestellt werden"
 
 #: scripts/dpkg-source.pl:664 scripts/dpkg-source.pl:1541
 msgid "something else"
@@ -1810,7 +1832,7 @@ msgstr "etwas anderes"
 
 #: scripts/dpkg-source.pl:665
 msgid "plain file"
-msgstr ""
+msgstr "einfache Datei"
 
 #: scripts/dpkg-source.pl:668
 msgid "fork for diff"
@@ -1822,12 +1844,14 @@ msgstr ""
 
 #: scripts/dpkg-source.pl:684
 msgid "binary file contents changed"
-msgstr ""
+msgstr "Inhalt der Binärdatei geändert"
 
 #: scripts/dpkg-source.pl:689
 #, perl-format
 msgid "file %s has no final newline (either original or modified version)"
 msgstr ""
+"Datei %s hat keinen abschließenden Zeilenumbruch (entweder Original oder "
+"modifizierte Version)"
 
 #: scripts/dpkg-source.pl:693
 #, perl-format
@@ -1840,7 +1864,7 @@ msgstr ""
 
 #: scripts/dpkg-source.pl:702
 msgid "diff gave 1 but no diff lines found"
-msgstr ""
+msgstr "Diff ergab 1 aber keine Diffzeilen gefunden"
 
 #: scripts/dpkg-source.pl:705
 #, perl-format
@@ -1849,7 +1873,7 @@ msgstr ""
 
 #: scripts/dpkg-source.pl:711
 msgid "device or socket is not allowed"
-msgstr ""
+msgstr "Gerät oder Socket ist nicht erlaubt"
 
 #: scripts/dpkg-source.pl:718
 msgid "not a directory"