diff options
author | Guillem Jover <guillem@debian.org> | 2014-05-23 15:49:01 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2014-05-23 15:49:01 +0200 |
commit | c2ee90f92ab6c915db774403414b2ea70c967c3e (patch) | |
tree | 376c4932c512c21aa3ecbe5b5f89cd14f49248cb /scripts | |
parent | 7ed4d813007158b956e493eb35b3645c96113e55 (diff) | |
download | dpkg-c2ee90f92ab6c915db774403414b2ea70c967c3e.tar.gz |
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>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Dpkg/Control/HashCore.pm | 15 | ||||
-rw-r--r-- | scripts/t/Dpkg_Changelog.t | 8 | ||||
-rw-r--r-- | scripts/t/Dpkg_Control.t | 2 |
3 files changed, 14 insertions, 11 deletions
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm index af41c7e90..05c168978 100644 --- a/scripts/Dpkg/Control/HashCore.pm +++ b/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; diff --git a/scripts/t/Dpkg_Changelog.t b/scripts/t/Dpkg_Changelog.t index 6fe3407e8..6a7fb42f3 100644 --- a/scripts/t/Dpkg_Changelog.t +++ b/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) diff --git a/scripts/t/Dpkg_Control.t b/scripts/t/Dpkg_Control.t index 8668b56a9..2e842d8fe 100644 --- a/scripts/t/Dpkg_Control.t +++ b/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 |