From: Ian Jackson Date: Sun, 19 Jan 2014 00:50:35 +0000 (+0000) Subject: Run a clean (of the specified type) before any build operation; do this with `dpkg... X-Git-Tag: debian/0.21~7 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=5dbf5d3d2ef07b059c732abe77d1657e3fc3f714 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/debian/changelog b/debian/changelog index 18ab7866..bfdb0e9d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 5b99ed1c..7752d824 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 ".."; diff --git a/dgit.1 b/dgit.1 index b23a3a85..67e47511 100644 --- 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