chiark / gitweb /
Cope properly with `3.0 (quilt)' with single-debian-patch. Closes:#796016.
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 92e48a0726b7e9b6759b7aae5cfba86d0bb5bbc9..eaba82b4143d2babd6157f89c746184e55ee9a6d 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2754,8 +2754,7 @@ sub build_maybe_quilt_fixup () {
     $upstreamversion =~ s/-[^-]*$//;
 
     if ($fopts->{'single-debian-patch'}) {
-       #quilt_fixup_singlepatch($clogp, $headref, $upstreamversion);
-       die;
+       quilt_fixup_singlepatch($clogp, $headref, $upstreamversion);
     } else {
        quilt_fixup_multipatch($clogp, $headref, $upstreamversion);
     }
@@ -2786,6 +2785,36 @@ sub quilt_fixup_linkorigs ($$) {
     }
 }
 
+sub quilt_fixup_delete_pc () {
+    runcmd @git, qw(rm -rqf .pc);
+    commit_admin "Commit removal of .pc (quilt series tracking data)";
+}
+
+sub quilt_fixup_singlepatch ($$$) {
+    my ($clogp, $headref, $upstreamversion) = @_;
+
+    # dpkg-source --commit generates new patches even if
+    # single-debian-patch is in debian/source/options.  In order to
+    # get it to generate debian/patches/debian-changes, it is
+    # necessary to build the source package.
+
+    quilt_fixup_linkorigs($upstreamversion, sub { });
+    quilt_fixup_mkwork($headref);
+
+    rmtree("debian/patches");
+
+    runcmd @dpkgsource, qw(-b .);
+    chdir "..";
+    runcmd @dpkgsource, qw(-x), (srcfn $version, ".dsc");
+    rename srcfn("$upstreamversion", "/debian/patches"), 
+           "work/debian/patches";
+
+    chdir "work";
+    commit_quilty_patch();
+
+    
+}
+
 sub quilt_fixup_multipatch ($$$) {
     my ($clogp, $headref, $upstreamversion) = @_;
 
@@ -2897,8 +2926,7 @@ END
     commit_quilty_patch();
 
     if ($mustdeletepc) {
-        runcmd @git, qw(rm -rqf .pc);
-        commit_admin "Commit removal of .pc (quilt series tracking data)";
+        quilt_fixup_delete_pc();
     }
 }