Ver código fonte

dpkg-source: support --single-debian-patch for "3.0 (quilt)"

With this option, the automatic patch is named
debian/patches/debian-changes instead of
debian/patches/debian-changes-<ver>. With this option, the new format
is closer to 1.0 with its single diff that is always updated.
Raphaël Hertzog 16 anos atrás
pai
commit
38dd2a45e4
3 arquivos alterados com 36 adições e 5 exclusões
  1. 4 0
      debian/changelog
  2. 18 4
      man/dpkg-source.1
  3. 14 1
      scripts/Dpkg/Source/Package/V3/quilt.pm

+ 4 - 0
debian/changelog

@@ -7,6 +7,10 @@ dpkg (1.15.5.4) UNRELEASED; urgency=low
     The option --without-quilt is thus gone and dpkg-source creates
     and relies on the .pc directory to know whether patches are applied
     or not. Closes: #557667
+  * Add new dpkg-source option --single-debian-patch supported by the source
+    format "3.0 (quilt)" so that it behaves more like 1.0 and its single diff
+    that is constantly updated with all upstream changes. Useful if the
+    workflow is VCS based and can't generate a full patch set.
 
  -- Raphael Hertzog <hertzog@debian.org>  Sun, 29 Nov 2009 18:15:16 +0100
 

+ 18 - 4
man/dpkg-source.1

@@ -402,10 +402,14 @@ patches have been applied during the extraction.
 All original tarballs found in the current directory are extracted in a
 temporary directory by following the same logic as for the unpack, the
 debian directory is copied over in the temporary directory, and all
-patches except \fBdebian-changes-\fP\fIversion\fP are applied.
-The temporary directory is compared to the source package directory
-and the diff (if non-empty) is stored in
-\fBdebian/patches/debian-changes-\fP\fIversion\fP. Any change
+patches except the automatic patch (\fBdebian-changes-\fP\fIversion\fP
+or \fBdebian-changes\fP, depending on \fB\-\-single\-debian\-patch\fP) are
+applied. The temporary directory is compared to the source package
+directory and the diff (if non-empty) is stored in the automatic patch.
+If the automatic patch is created/deleted, it's added/removed from the
+series file and from the quilt metadata.
+
+Any change
 on a binary file is not representable in a diff and will thus lead to a
 failure unless the maintainer deliberately decided to include that
 modified binary file in the debian tarball (by listing it in
@@ -452,6 +456,14 @@ in subsequent builds and this option is thus no more needed.
 .B \-\-no\-preparation
 Do not try to prepare the build tree by applying patches which are
 apparently unapplied.
+.TP
+.B \-\-single\-debian\-patch
+Use \fBdebian/patches/debian-changes\fP instead of
+\fBdebian/patches/debian-changes-\fP\fIversion\fP for the name of the
+automatic patch generated during build. This option is particularly
+useful when you maintain a package in a VCS and you can't reliably
+generate a patch set, instead you just want to store the current
+diff with upstream in a single patch.
 .PP
 .B Extract options
 .TP
@@ -518,6 +530,8 @@ Here's an example of such a file:
   # let dpkg-source create a debian.tar.bz2 with maximal compression
   compression = "bzip2"
   compression-level = 9
+  # use debian/patches/debian-changes as automatic patch
+  single-debian-patch
 .P
 Note: \fBformat\fR options are not accepted in this file, you should
 use \fBdebian/source/format\fR instead.

+ 14 - 1
scripts/Dpkg/Source/Package/V3/quilt.pm

@@ -40,12 +40,19 @@ our $CURRENT_MINOR_VERSION = "0";
 
 sub init_options {
     my ($self) = @_;
+    $self->{'options'}{'single-debian-patch'} = 0
+        unless exists $self->{'options'}{'single-debian-patch'};
+
     $self->SUPER::init_options();
 }
 
 sub parse_cmdline_option {
     my ($self, $opt) = @_;
     return 1 if $self->SUPER::parse_cmdline_option($opt);
+    if ($opt =~ /^--single-debian-patch$/) {
+        $self->{'options'}{'single-debian-patch'} = 1;
+        return 1;
+    }
     return 0;
 }
 
@@ -69,7 +76,11 @@ sub can_build {
 
 sub get_autopatch_name {
     my ($self) = @_;
-    return "debian-changes-" . $self->{'fields'}{'Version'};
+    if ($self->{'options'}{'single-debian-patch'}) {
+        return "debian-changes";
+    } else {
+        return "debian-changes-" . $self->{'fields'}{'Version'};
+    }
 }
 
 sub get_series_file {
@@ -286,6 +297,8 @@ sub get_patch_header {
     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";