From 1b10a64b592e140a9d6bd34e3d7d6f7cfe0faf38 Mon Sep 17 00:00:00 2001 From: Raphaƫl Hertzog Date: Fri, 30 Oct 2009 09:47:32 +0100 Subject: Dpkg::Changelog::Entry: add get_dpkg_changes() method here This is the logical place for this function (as an object method). --- scripts/Dpkg/Changelog/Entry.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'scripts/Dpkg/Changelog') 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 field +in the output format of C. + +=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 -- cgit v1.2.3