chiark / gitweb /
Run a clean (of the specified type) before any build operation; do this with `dpkg...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jan 2014 00:50:35 +0000 (00:50 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jan 2014 00:50:35 +0000 (00:50 +0000)
debian/changelog
dgit
dgit.1

index 18ab78661e669c7f6c0ab4be3aa6969631b19f0b..bfdb0e9d6ebdb8c64d62918ebced7d35991fc6af 100644 (file)
@@ -7,6 +7,9 @@ dgit (0.21~~iwj) unstable; urgency=low
     with earlier versions of dpkg.
   * Provide --build-products-dir option (and corresponding semantics
     for -C) to specify where to find the files to upload.  Closes:#731633.
+  * Run a clean (of the specified type) before any build operation; do
+    this with `dpkg-buildpackage -T' clean if necessary, so -wd now works
+    with all the building methods.
 
  --
 
diff --git a/dgit b/dgit
index 5b99ed1cde43acf7e58f89886542bda82fd0005f..7752d824f6c30023304ac8a0716d84f67d41a2eb 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -1793,9 +1793,21 @@ sub quilt_fixup_editor () {
     exit 0;
 }
 
+sub clean_tree () {
+    if ($cleanmode eq 'dpkg-source') {
+       runcmd_ordryrun_local @dpkgbuildpackage, qw(-T clean);
+    } elsif ($cleanmode eq 'git') {
+       runcmd_ordryrun_local @git, qw(clean -xdf);
+    } elsif ($cleanmode eq 'none') {
+    } else {
+       die "$cleanmode ?";
+    }
+}
+
 sub build_prep () {
     badusage "-p is not allowed when building" if defined $package;
     check_not_dirty();
+    clean_tree();
     my $clogp = parsechangelog();
     $isuite = getfield $clogp, 'Distribution';
     $package = getfield $clogp, 'Source';
@@ -1824,16 +1836,12 @@ sub changesopts () {
 }
 
 sub cmd_build {
-    badusage "dgit build implies --clean=dpkg-source"
-       if $cleanmode ne 'dpkg-source';
     build_prep();
     runcmd_ordryrun_local @dpkgbuildpackage, qw(-us -uc), changesopts(), @ARGV;
     printdone "build successful\n";
 }
 
 sub cmd_git_build {
-    badusage "dgit git-build implies --clean=dpkg-source"
-       if $cleanmode ne 'dpkg-source';
     build_prep();
     my @cmd =
        (qw(git-buildpackage -us -uc --git-no-sign-tags),
@@ -1855,12 +1863,6 @@ sub build_source {
        runcmd_ordryrun_local (@dpkgbuildpackage, qw(-us -uc -S)),
            changesopts();
     } else {
-       if ($cleanmode eq 'git') {
-           runcmd_ordryrun_local @git, qw(clean -xdf);
-       } elsif ($cleanmode eq 'none') {
-       } else {
-           die "$cleanmode ?";
-       }
        my $pwd = cmdoutput qw(env - pwd);
        my $leafdir = basename $pwd;
        changedir "..";
diff --git a/dgit.1 b/dgit.1
index b23a3a85c671ebf9ca8f2c73956db70df89573cf..67e4751190dcd7d92c6392aa5fe3b6d3186c7676 100644 (file)
--- a/dgit.1
+++ b/dgit.1
@@ -217,7 +217,7 @@ 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.
 .TP
 .BR --clean=dpkg-source | -wd
-Use dpkg-buildpackage to do the build, so that the source package
+Use dpkg-buildpackage to do the clean, so that the source package
 is cleaned by dpkg-source running the package's clean target.
 This is the default.  It requires the package's build dependencies.
 .TP