diff options
author | Raphaël Hertzog <hertzog@debian.org> | 2009-10-30 09:47:32 +0100 |
---|---|---|
committer | Raphaël Hertzog <hertzog@debian.org> | 2009-10-31 22:42:12 +0100 |
commit | 1b10a64b592e140a9d6bd34e3d7d6f7cfe0faf38 (patch) | |
tree | 088d7343b32db19e5cee9d2a6f248bd64c428f12 /scripts/Dpkg/Changelog/Entry.pm | |
parent | 30421dbe46f769b4e2333af8baf7269698cbc050 (diff) | |
download | dpkg-1b10a64b592e140a9d6bd34e3d7d6f7cfe0faf38.tar.gz |
Dpkg::Changelog::Entry: add get_dpkg_changes() method here
This is the logical place for this function (as an object method).
Diffstat (limited to 'scripts/Dpkg/Changelog/Entry.pm')
-rw-r--r-- | scripts/Dpkg/Changelog/Entry.pm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/Dpkg/Changelog/Entry.pm b/scripts/Dpkg/Changelog/Entry.pm index 4cd78a032..c67d456c9 100644 --- a/scripts/Dpkg/Changelog/Entry.pm +++ b/scripts/Dpkg/Changelog/Entry.pm @@ -273,6 +273,30 @@ sub get_timestamp { return undef; } +=item my $str = $entry->get_dpkg_changes() + +Returns a string that is suitable for usage in a C<Changes> field +in the output format of C<dpkg-parsechangelog>. + +=cut + +sub get_dpkg_changes { + my ($self) = @_; + my $header = $self->get_part("header") || ""; + $header =~ s/\s+$//; + my $changes = "\n $header\n .\n"; + foreach my $line (@{$self->get_part("changes")}) { + $line =~ s/\s+$//; + if ($line eq "") { + $changes .= " .\n"; + } else { + $changes .= " $line\n"; + } + } + chomp $changes; + return $changes; +} + =back =head1 AUTHOR |