The following commit has been merged in the master branch:
commit 2a194c6cc6e534d090b9c99b6ef53b5b1a0e2ce1
Author: Raphaël Hertzog <[email protected]>
Date: Thu Oct 8 21:05:38 2009 +0200
Dpkg::Changelog::Debian: preserve blank lines
The blank lines separating the header, changes and trailer lines
were lost in the parsing. Now they are stored in three new attributes
of Dpkg::Changelog::Entry.
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index e4fd8cd..5aca5b4 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -500,6 +500,8 @@ BEGIN {
@CHANGELOG_FIELDS = qw(Source Version Distribution
Urgency Maintainer Date Closes Changes
Timestamp Header Items Trailer
+ BlankAfterHeader BlankAfterChanges
+ BlankAfterTrailer
Urgency_comment Urgency_lc);
$CHANGELOG_FIELDS = Dpkg::Control->new(type => CTRL_CHANGELOG);
%$CHANGELOG_FIELDS = map { $_ => 1 } @CHANGELOG_FIELDS;
diff --git a/scripts/Dpkg/Changelog/Debian.pm b/scripts/Dpkg/Changelog/Debian.pm
index 454697e..3b7df30 100644
--- a/scripts/Dpkg/Changelog/Debian.pm
+++ b/scripts/Dpkg/Changelog/Debian.pm
@@ -156,6 +156,9 @@ sub parse {
$entry->{'Header'} = "$_";
($entry->{'Distribution'} = "$3") =~ s/^\s+//;
$entry->{'Changes'} = [];
+ $entry->{'BlankAfterHeader'} = [];
+ $entry->{'BlankAfterChanges'} = [];
+ $entry->{'BlankAfterTrailer'} = [];
$entry->{'Urgency_comment'} = '';
$entry->{'Urgency'} = $entry->{'Urgency_lc'} = 'unknown';
}
@@ -226,6 +229,8 @@ sub parse {
_g( "badly formatted trailer line" ),
"$_");
}
+ push @{$entry->{BlankAfterChanges}}, @blanklines;
+ @blanklines = ();
$entry->{'Trailer'} = $_;
$entry->{'Maintainer'} = "$1 <$2>" unless $entry->{'Maintainer'};
unless($entry->{'Date'} && defined $entry->{'Timestamp'}) {
@@ -281,12 +286,16 @@ sub parse {
@blanklines = ();
$expect = 'more change data or trailer';
} elsif (!m/\S/) {
- next if $expect eq 'start of change data'
- || $expect eq 'next heading or eof';
- $expect eq 'more change data or trailer'
- || $self->_do_parse_error($file, $NR,
- sprintf(_g("found blank line where
expected %s"),
- $expect));
+ if ($expect eq 'start of change data') {
+ push @{$entry->{BlankAfterHeader}}, $_;
+ next;
+ } elsif ($expect eq 'next heading or eof') {
+ push @{$entry->{BlankAfterTrailer}}, $_;
+ next;
+ } elsif ($expect ne 'more change data or trailer') {
+ $self->_do_parse_error($file, $NR,
+ sprintf(_g("found blank line where expected %s"),
$expect));
+ }
push @blanklines, $_;
} else {
$self->_do_parse_error($file, $NR, _g( "unrecognised line" ),
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]