[Reproducible-commits] [dpkg] 03/08: dpkg-source: fix automatic patch registration in format 3.0 (quilt)

Holger Levsen holger at layer-acht.org
Tue May 3 08:43:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to annotated tag 1.14.27
in repository dpkg.

commit 0481c7052840bbce878a3c7b0332883e8f2768bd
Author: Raphael Hertzog <hertzog at debian.org>
Date:   Sun May 10 17:30:02 2009 +0200

    dpkg-source: fix automatic patch registration in format 3.0 (quilt)
    
    When the automatic patch is updated due to a second call to
    dpkg-source, it's not always properly registered with quilt.
    It must be applied with quilt itself otherwise quilt pop
    then quilt push might fail when supplementary files have been modified
    outside of quilt's knowledge.
    
    Furthermore quilt import was not a good choice as it failed trying to copy
    the patch over itself. The new approach is to revert the patch and let
    quilt reapply it with quilt fold. It will go over the list of files
    modified by the new patch and add those which were not yet part of the
    previous patch (hence adding the required unmodified files in
    .pc/<patch-name>/).
    
    Based-on-patch-by: Goswin von Brederlow <goswin-v-b at web.de>
---
 debian/changelog                        |  4 ++++
 scripts/Dpkg/Source/Package/V3/quilt.pm | 22 ++++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 215c4af..8ddc303 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,10 @@ dpkg (1.14.27) UNRELEASED; urgency=low
   * Cherry-pick some fixes from squeeze concerning new source formats:
     - dpkg-source now accepts additional tarballs (in format "3.0 (quilt)")
       with a "component" name containing dashes. Closes: #524376
+    - ensure that the automatic patch created in format "3.0 (quilt)" is
+      always well registered with quilt even when it's updated by a new call
+      to dpkg-source. Thanks to Goswin von Brederlow for the initial patch.
+      Closes: #525858
 
  -- Raphael Hertzog <hertzog at debian.org>  Thu, 09 Apr 2009 20:32:31 +0200
 
diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm b/scripts/Dpkg/Source/Package/V3/quilt.pm
index 3099264..05c1067 100644
--- a/scripts/Dpkg/Source/Package/V3/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/quilt.pm
@@ -239,13 +239,15 @@ sub register_autopatch {
                 not $self->{'options'}{'without_quilt'})
             {
                 # Registering the new patch with quilt requires some
-                # trickery: reverse-apply the patch, import it, apply it
-                # again with quilt this time
+                # trickery: reverse-apply the patch, create a new quilt patch,
+                # fold the patch into the quilt-managed one
                 my $patch_obj = Dpkg::Source::Patch->new(filename => $patch);
                 $patch_obj->apply($dir, add_options => ['-R', '-E']);
-                $self->run_quilt($dir, ['import', "$absdir/debian/patches/$auto_patch"],
+                $self->run_quilt($dir, ['new', "$auto_patch"],
+                                 wait_child => 1, to_file => '/dev/null');
+                $self->run_quilt($dir, ['fold'],
+                                 from_file => "$absdir/debian/patches/$auto_patch",
                                  wait_child => 1, to_file => '/dev/null');
-                $self->run_quilt($dir, ['push'], wait_child => 1, to_file => '/dev/null');
             } else {
                 open(SERIES, ">>", $series) || syserr(_g("cannot write %s"), $series);
                 print SERIES "$auto_patch\n";
@@ -254,6 +256,18 @@ sub register_autopatch {
             open(APPLIED, ">>", $applied) || syserr(_g("cannot write %s"), $applied);
             print APPLIED "$auto_patch\n";
             close(APPLIED);
+        } else {
+            # If quilt was used, ensure its meta-information are
+            # synchronized with the updated patch
+            if (-d "$dir/.pc" and not $self->{'options'}{'without_quilt'}) {
+                # Some trickery needed: reverse-apply the patch, fold the
+                # new patch into the quilt-managed one
+                my $patch_obj = Dpkg::Source::Patch->new(filename => $patch);
+                $patch_obj->apply($dir, add_options => ['-R', '-E']);
+                $self->run_quilt($dir, ['fold'],
+                                 from_file => "$absdir/debian/patches/$auto_patch",
+                                 wait_child => 1, to_file => '/dev/null');
+            }
         }
     } else {
         # Remove auto_patch from series

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list