The following commit has been merged in the master branch:
commit 1b10a64b592e140a9d6bd34e3d7d6f7cfe0faf38
Author: Raphaël Hertzog <[email protected]>
Date:   Fri Oct 30 09:47:32 2009 +0100

    Dpkg::Changelog::Entry: add get_dpkg_changes() method here
    
    This is the logical place for this function (as an object method).

diff --git a/scripts/Dpkg/Changelog/Entry.pm b/scripts/Dpkg/Changelog/Entry.pm
index 4cd78a0..c67d456 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

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to