chiark / gitweb /
--clean=git and --clean=none cause dgit to pass -nc to dpkg-buildpackage, suppressing...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 30 Jun 2015 20:25:38 +0000 (21:25 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 4 Jul 2015 18:24:46 +0000 (19:24 +0100)
debian/changelog
dgit
dgit.1

index 4f2e64da20d0ff32074b63abb25b2f8f7cd6e9d7..5724e024bfbc11ca0f79a25a0c9571f1e000453c 100644 (file)
@@ -82,6 +82,10 @@ dgit (0.23~) unstable; urgency=low
   * Document that dgit repos are cloneable with git, in dgit(1)
     section MODEL.  [Andreas Barth.]  Closes:#768470.
 
+  * --clean=git and --clean=none cause dgit to pass -nc to
+    dpkg-buildpackage, suppressing calls to the package's clean target.
+    Also, expand the documentation in this area slightly.  Closes:#768590.
+
  --
 
 dgit (0.22.1) unstable; urgency=high
diff --git a/dgit b/dgit
index 19c0657b17eb6741edf3112c8fba0ed9ce9d76b5..f0f16518f44ba58877ec6b5894ffc3a4136675d0 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -2628,17 +2628,35 @@ sub changesopts () {
     return @opts;
 }
 
+sub massage_dbp_args ($) {
+    my ($cmd) = @_;
+    return unless $cleanmode =~ m/git|none/;
+    debugcmd '#massaging#', @$cmd if $debuglevel>1;
+    my @newcmd = shift @$cmd;
+    # -nc has the side effect of specifying -b if nothing else specified
+    push @newcmd, '-nc';
+    # and some combinations of -S, -b, et al, are errors, rather than
+    # later simply overriding earlier
+    push @newcmd, '-F' unless grep { m/^-[bBASF]$/ } @$cmd;
+    push @newcmd, @$cmd;
+    @$cmd = @newcmd;
+}
+
 sub cmd_build {
     build_prep();
-    runcmd_ordryrun_local @dpkgbuildpackage, qw(-us -uc), changesopts(), @ARGV;
+    my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts(), @ARGV);
+    massage_dbp_args \@dbp;
+    runcmd_ordryrun_local @dbp;
     printdone "build successful\n";
 }
 
 sub cmd_git_build {
     build_prep();
+    my @dbp = @dpkgbuildpackage;
+    massage_dbp_args \@dbp;
     my @cmd =
        (qw(git-buildpackage -us -uc --git-no-sign-tags),
-        "--git-builder=@dpkgbuildpackage");
+        "--git-builder=@dbp");
     unless (grep { m/^--git-debian-branch|^--git-ignore-branch/ } @ARGV) {
        canonicalise_suite();
        push @cmd, "--git-debian-branch=".lbranch();
diff --git a/dgit.1 b/dgit.1
index 9705f0af2403abc84d2a07f07410dd6fb80125b0..f183e8e56df58f81ed9ba70c69c2b22200e71631 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -248,11 +248,20 @@ Valid with dgit fetch and dgit pull, only.
 The source tree should be cleaned, before building a source package
 with one of the build options, using
 .BR "git clean -xdf" .
-This will delete all files which are not tracked by git.
+This will delete all files which are not tracked by git.  Also, -wg
+causes dgit to pass
+.B -nc
+to dpkg-buildpackage, which prevents the package's own clean target
+from being run.
+
+--clean=git is useful when the package's clean target is troublesome;
+the downside is simply that git clean may delete files you forgot to
+git add.
 .TP
 .BR --clean=none | -wn
 Do not clean the tree before building a source package.  If there are
-files which are not in git, a subsequent dgit push will fail.
+files which are not in git, or if the build creates such files, a
+subsequent dgit push will fail.
 .TP
 .BR --clean=dpkg-source | -wd
 Use dpkg-buildpackage to do the clean, so that the source package