summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2014-01-19 00:50:35 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2014-01-19 00:50:35 +0000
commit5dbf5d3d2ef07b059c732abe77d1657e3fc3f714 (patch)
tree66ef226e70e1b5f85f68b10e519dcd759b8eb74c /dgit
parent95cce6041df774f7909b28c110417881f1d4792a (diff)
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.
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit22
1 files changed, 12 insertions, 10 deletions
diff --git a/dgit b/dgit
index 5b99ed1..7752d82 100755
--- 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 "..";