diff options
author | Raphaël Hertzog <hertzog@debian.org> | 2009-10-08 21:05:38 +0200 |
---|---|---|
committer | Raphaël Hertzog <hertzog@debian.org> | 2009-10-08 21:05:38 +0200 |
commit | 2a194c6cc6e534d090b9c99b6ef53b5b1a0e2ce1 (patch) | |
tree | 835982aa7e76a2fcf852299eeaba6146e0b65c2f /scripts | |
parent | c8fc6e93151a6f7bea92eb5b9d41d3aaab12aee3 (diff) | |
download | dpkg-2a194c6cc6e534d090b9c99b6ef53b5b1a0e2ce1.tar.gz |
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.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Dpkg/Changelog.pm | 2 | ||||
-rw-r--r-- | scripts/Dpkg/Changelog/Debian.pm | 21 |
2 files changed, 17 insertions, 6 deletions
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm index e4fd8cdf1..5aca5b449 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 454697e79..3b7df304b 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" ), |