summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-07-27 03:46:32 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-07-27 13:11:46 +0100
commitdbb093b1db7b27bf922f6ad58576cab4fbc342cf (patch)
treebc207af31c8bd33cc77b2a575949fb71eb2b5171
parentc0a28dc2cf305ca157bff1cb7b71a69b7f73b324 (diff)
When we are using dpkg-buildpackage to clean before using it to also do the build, let it do its cleaning thing as part of its run, rather than running it twice. When we are _not_ supposed to be using dpkg-buildpackage to clean, but we are running it to do the build, pass -nc.
-rw-r--r--debian/changelog5
-rwxr-xr-xdgit33
2 files changed, 31 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index ecdd991..2f29630 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -56,6 +56,11 @@ dgit (1.1~~) unstable; urgency=low
* Rename `git-build' operation to `gbp-build' to make it clearer what
it's for. Keep the old name as an alias.
* Show `dgit sbuild' in usage message.
+ * When we are using dpkg-buildpackage to clean before using it to also
+ do the build, let it do its cleaning thing as part of its run, rather
+ than running it twice. When we are _not_ supposed to be using
+ dpkg-buildpackage to clean, but we are running it to do the build,
+ pass -nc.
--
diff --git a/dgit b/dgit
index 773f19d..22a1ccd 100755
--- a/dgit
+++ b/dgit
@@ -2867,7 +2867,10 @@ sub quilt_fixup_editor () {
#----- other building -----
+our $suppress_clean;
+
sub clean_tree () {
+ return if $suppress_clean;
if ($cleanmode eq 'dpkg-source') {
runcmd_ordryrun_local @dpkgbuildpackage, qw(-T clean);
} elsif ($cleanmode eq 'dpkg-source-d') {
@@ -2906,8 +2909,11 @@ sub build_prep () {
build_maybe_quilt_fixup();
}
-sub changesopts () {
+sub changesopts_initial () {
my @opts =@changesopts[1..$#changesopts];
+}
+
+sub changesopts_version () {
if (!defined $changes_since_version) {
my @vsns = archive_query('archive_query');
my @quirk = access_quirk();
@@ -2928,14 +2934,22 @@ sub changesopts () {
}
}
if ($changes_since_version ne '_') {
- unshift @opts, "-v$changes_since_version";
+ return ("-v$changes_since_version");
+ } else {
+ return ();
}
- return @opts;
+}
+
+sub changesopts () {
+ return (changesopts_initial(), changesopts_version());
}
sub massage_dbp_args ($) {
my ($cmd) = @_;
- return unless $cleanmode =~ m/git|none/;
+ if ($cleanmode eq 'dpkg-source') {
+ $suppress_clean = 1;
+ return;
+ }
debugcmd '#massaging#', @$cmd if $debuglevel>1;
my @newcmd = shift @$cmd;
# -nc has the side effect of specifying -b if nothing else specified
@@ -2948,17 +2962,18 @@ sub massage_dbp_args ($) {
}
sub cmd_build {
- build_prep();
- my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts(), @ARGV);
+ my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts_initial(), @ARGV);
massage_dbp_args \@dbp;
+ build_prep();
+ push @dbp, changesopts_version();
runcmd_ordryrun_local @dbp;
printdone "build successful\n";
}
sub cmd_gbp_build {
- build_prep();
my @dbp = @dpkgbuildpackage;
massage_dbp_args \@dbp;
+ build_prep();
my @cmd =
(qw(git-buildpackage -us -uc --git-no-sign-tags),
"--git-builder=@dbp");
@@ -2973,6 +2988,10 @@ sub cmd_gbp_build {
sub cmd_git_build { cmd_gbp_build(); } # compatibility with <= 1.0
sub build_source {
+ if ($cleanmode =~ m/^dpkg-source/) {
+ # dpkg-source will clean, so we shouldn't
+ $suppress_clean = 1;
+ }
build_prep();
$sourcechanges = "${package}_".(stripepoch $version)."_source.changes";
$dscfn = dscfn($version);