Просмотр исходного кода

Dpkg::Control::HashCore: Do not emit trailing space on field empty first line

This spurious space is unnecessary and takes a non-insignificant amount
of disk space on archive index files for example.

Update dpkg-dev Breaks on devscripts to version << 2.14.4, as previous
versions of debchange expect a trailing space from dpkg-parsechangelog
output.

Closes: #749044

Based-on-patch-by: Johannes Schauer <j.schauer@email.de>
Guillem Jover лет назад: 12
Родитель
Сommit
c2ee90f92a
5 измененных файлов с 19 добавлено и 12 удалено
  1. 4 0
      debian/changelog
  2. 1 1
      debian/control
  3. 9 6
      scripts/Dpkg/Control/HashCore.pm
  4. 4 4
      scripts/t/Dpkg_Changelog.t
  5. 1 1
      scripts/t/Dpkg_Control.t

+ 4 - 0
debian/changelog

@@ -48,6 +48,10 @@ dpkg (1.17.10) UNRELEASED; urgency=low
     Closes: #584233
   * Quiesce tar warnings in cron job by redirecting stderr to /dev/null, as
     it seems --warning=none does not work correctly. Closes: #748544
+  * Do not emit a trailing space from Dpkg::Control::Hash on a field's empty
+    first line. Bump dpkg-dev Breaks on devscripts to 2.14.4, as previous
+    versions expect a trailing space from dpkg-parsechangelog output.
+    Based on a patch by Johannes Schauer <j.schauer@email.de>. Closes: #749044
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).

+ 1 - 1
debian/control

@@ -74,7 +74,7 @@ Depends: libdpkg-perl (= ${source:Version}), bzip2, xz-utils,
 Recommends: gcc | c-compiler, build-essential, fakeroot,
  gnupg | gnupg2, gpgv | gpgv2, libalgorithm-merge-perl
 Suggests: debian-keyring
-Breaks: dpkg-cross (<< 2.0.0), devscripts (<< 2.10.26)
+Breaks: dpkg-cross (<< 2.0.0), devscripts (<< 2.14.4)
 Replaces: manpages-it (<< 2.80-4)
 Description: Debian package development tools
  This package provides the development tools (including dpkg-source)

+ 9 - 6
scripts/Dpkg/Control/HashCore.pm

@@ -349,22 +349,25 @@ sub output {
             # Skip whitespace-only fields
             next if $$self->{drop_empty} and $value !~ m/\S/;
 	    # Escape data to follow control file syntax
-	    my @lines = split(/\n/, $value);
-	    $value = (scalar @lines) ? shift @lines : '';
+	    my ($first_line, @lines) = split /\n/, $value;
+
+	    my $kv = "$key:";
+	    $kv .= ' ' . $first_line if $first_line;
+	    $kv .= "\n";
 	    foreach (@lines) {
 		s/\s+$//;
 		if (/^$/ or /^\.+$/) {
-		    $value .= "\n .$_";
+		    $kv .= " .$_\n";
 		} else {
-		    $value .= "\n $_";
+		    $kv .= " $_\n";
 		}
 	    }
 	    # Print it out
             if ($fh) {
-	        print { $fh } "$key: $value\n"
+	        print { $fh } $kv
 	            or syserr(_g('write error on control data'));
             }
-	    $str .= "$key: $value\n" if defined wantarray;
+	    $str .= $kv if defined wantarray;
 	}
     }
     return $str;

+ 4 - 4
scripts/t/Dpkg_Changelog.t

@@ -173,7 +173,7 @@ Urgency: high
 Maintainer: Frank Lichtenheld <frank@lichtenheld.de>
 Date: Sun, 13 Jan 2008 15:49:19 +0100
 Closes: 1000000 1111111 2222222
-Changes: 
+Changes:
  fields (2.0-0etch1) stable; urgency=low
  .
    * Upload to stable (Closes: #1111111, #2222222)
@@ -214,7 +214,7 @@ Urgency: medium
 Maintainer: Frank Lichtenheld <djpig@debian.org>
 Date: Sun, 12 Jan 2008 15:49:19 +0100
 Closes: 1111111 2222222
-Changes: 
+Changes:
  fields (2.0-1) unstable  frozen; urgency=medium
  .
    [ Frank Lichtenheld ]
@@ -244,7 +244,7 @@ Distribution: unstable
 Urgency: low
 Maintainer: Frank Lichtenheld <frank@lichtenheld.de>
 Date: Sun, 11 Jan 2008 15:49:19 +0100
-Changes: 
+Changes:
  fields (2.0~b1-1) unstable; urgency=low,xc-userfield=foobar
  .
    * Beta
@@ -257,7 +257,7 @@ Urgency: high
 Maintainer: Frank Lichtenheld <djpig@debian.org>
 Date: Sun, 10 Jan 2008 15:49:19 +0100
 Closes: 1000000
-Changes: 
+Changes:
  fields (1.0) experimental; urgency=high,xb-userfield2=foobar
  .
    * First upload (Closes: #1000000)

+ 1 - 1
scripts/t/Dpkg_Control.t

@@ -53,7 +53,7 @@ Long-Field: line1
    line 3 line 3 line 3
  ..
  line 4
-Empty-Field: 
+Empty-Field:
 
 Package: mypackage1
 Architecture: any