The following commit has been merged in the master branch:
commit be128c8f7960f05d3be727478c8078af1c1bfd72
Author: Raphaël Hertzog <hert...@debian.org>
Date:   Thu Jul 14 19:02:49 2011 +0200

    dpkg-source: uniform handling of the patch header
    
    Formats "2.0" and "3.0 (quilt)" now generate the patch header
    with the same code. Drop some useless duplication.

diff --git a/scripts/Dpkg/Source/Package/V2.pm 
b/scripts/Dpkg/Source/Package/V2.pm
index 7a1880a..8be3312 100644
--- a/scripts/Dpkg/Source/Package/V2.pm
+++ b/scripts/Dpkg/Source/Package/V2.pm
@@ -1,4 +1,4 @@
-# Copyright © 2008 Raphaël Hertzog <hert...@debian.org>
+# Copyright © 2008-2011 Raphaël Hertzog <hert...@debian.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -30,6 +30,9 @@ use Dpkg::Source::Archive;
 use Dpkg::Source::Patch;
 use Dpkg::Exit;
 use Dpkg::Source::Functions qw(erasedir is_binary fs_time);
+use Dpkg::Vendor qw(run_vendor_hook);
+use Dpkg::Control;
+use Dpkg::Changelog::Parse;
 
 use POSIX;
 use File::Basename;
@@ -526,7 +529,7 @@ sub do_build {
 }
 
 sub get_patch_header {
-    my ($self, $dir, $previous) = @_;
+    my ($self, $dir) = @_;
     my $ph = File::Spec->catfile($dir, "debian", "source", 
"local-patch-header");
     unless (-f $ph) {
         $ph = File::Spec->catfile($dir, "debian", "source", "patch-header");
@@ -538,10 +541,34 @@ sub get_patch_header {
         close(PH);
         return $text;
     }
-    return "Description: Undocumented upstream changes
- This patch has been created by dpkg-source during the package build
- but it might have accumulated changes from several uploads. Please
- check the changelog to (hopefully) learn more on those changes.\n\n";
+    my $ch_info = changelog_parse(offset => 0, count => 1,
+        file => File::Spec->catfile($dir, "debian", "changelog"));
+    return '' if not defined $ch_info;
+    my $header = Dpkg::Control->new(type => CTRL_UNKNOWN);
+    $header->{'Description'} = "<short summary of the patch>\n";
+    $header->{'Description'} .=
+"TODO: Put a short summary on the line above and replace this paragraph
+with a longer explanation of this change. Complete the meta-information
+with other relevant fields (see below for details). To make it easier, the
+information below has been extracted from the changelog. Adjust it or drop
+it.\n";
+    $header->{'Description'} .= $ch_info->{'Changes'} . "\n";
+    $header->{'Author'} = $ch_info->{'Maintainer'};
+    $text = "$header";
+    run_vendor_hook("extend-patch-header", \$text, $ch_info);
+    $text .= "\n---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>\n\n";
+    return $text;
 }
 
 sub register_autopatch {
diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm 
b/scripts/Dpkg/Source/Package/V3/quilt.pm
index eb201c1..42064e2 100644
--- a/scripts/Dpkg/Source/Package/V3/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/quilt.pm
@@ -1,4 +1,4 @@
-# Copyright © 2008-2009 Raphaël Hertzog <hert...@debian.org>
+# Copyright © 2008-2011 Raphaël Hertzog <hert...@debian.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,9 +29,7 @@ use Dpkg::ErrorHandling;
 use Dpkg::Source::Patch;
 use Dpkg::Source::Functions qw(erasedir fs_time);
 use Dpkg::IPC;
-use Dpkg::Vendor qw(get_current_vendor run_vendor_hook);
-use Dpkg::Control;
-use Dpkg::Changelog::Parse;
+use Dpkg::Vendor qw(get_current_vendor);
 
 use POSIX;
 use File::Basename;
@@ -386,51 +384,5 @@ sub register_autopatch {
     }
 }
 
-sub get_patch_header {
-    my ($self, $dir, $previous) = @_;
-    my $ph = File::Spec->catfile($dir, "debian", "source", 
"local-patch-header");
-    unless (-f $ph) {
-        $ph = File::Spec->catfile($dir, "debian", "source", "patch-header");
-    }
-    my $text;
-    if (-f $ph) {
-        open(PH, "<", $ph) || syserr(_g("cannot read %s"), $ph);
-        $text = join("", <PH>);
-        close(PH);
-        return $text;
-    }
-    my $ch_info = changelog_parse(offset => 0, count => 1,
-        file => File::Spec->catfile($dir, "debian", "changelog"));
-    return '' if not defined $ch_info;
-    return $self->SUPER::get_patch_header($dir, $previous)
-        if $self->{'options'}{'single-debian-patch'};
-    my $header = Dpkg::Control->new(type => CTRL_UNKNOWN);
-    $header->{'Description'} = "Upstream changes introduced in version " .
-                               $ch_info->{'Version'} . "\n";
-    $header->{'Description'} .=
-"This patch has been created by dpkg-source during the package build.
-Here's the last changelog entry, hopefully it gives details on why
-those changes were made:\n";
-    $header->{'Description'} .= $ch_info->{'Changes'} . "\n";
-    $header->{'Description'} .=
-"\nThe person named in the Author field signed this changelog entry.\n";
-    $header->{'Author'} = $ch_info->{'Maintainer'};
-    $text = "$header";
-    run_vendor_hook("extend-patch-header", \$text, $ch_info);
-    $text .= "\n---
-The information above should follow the Patch Tagging Guidelines, please
-checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
-are templates for supplementary fields that you might want to add:
-
-Origin: <vendor|upstream|other>, <url of original patch>
-Bug: <url in upstream bugtracker>
-Bug-Debian: http://bugs.debian.org/<bugnumber>
-Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
-Forwarded: <no|not-needed|url proving that it has been forwarded>
-Reviewed-By: <name and email of someone who approved the patch>
-Last-Update: <YYYY-MM-DD>\n\n";
-    return $text;
-}
-
 # vim:et:sw=4:ts=8
 1;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to