chiark / gitweb /
dgit: build_source_for_push does not try to unapply patches
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 470c0fd9fde00d1b02d26b93e37530ee1ffc2d80..b3c95c7c52544ef9c2a75a71d78cd42dddb2851f 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -166,7 +166,7 @@ our $keyid;
 autoflush STDOUT 1;
 
 our $supplementary_message = '';
-our $need_split_build_invocation = 0;
+our $need_split_build_invocation = 1;
 our $split_brain = 0;
 
 END {
@@ -4756,6 +4756,8 @@ sub cmd_push {
     dopush();
 }
 
+our $sourcechanges;
+
 sub cmd_push_source {
     prep_push();
     fail "dgit push-source: --include-dirty/--ignore-dirty does not make".
@@ -5062,7 +5064,6 @@ sub i_want_signed_dsc_changes {
 #---------- building etc. ----------
 
 our $version;
-our $sourcechanges;
 our $dscfn;
 
 #----- `3.0 (quilt)' handling -----
@@ -6108,6 +6109,10 @@ sub cmd_clean () {
     maybe_unapply_patches_again();
 }
 
+# return values from massage_dbp_args are one or both of these flags
+sub WANTSRC_SOURCE  () { 01; } # caller should build source (separately)
+sub WANTSRC_BUILDER () { 02; } # caller should run dpkg-buildpackage
+
 sub build_or_push_prep_early () {
     our $build_or_push_prep_early_done //= 0;
     return if $build_or_push_prep_early_done++;
@@ -6183,10 +6188,6 @@ sub changesopts () {
     return (changesopts_initial(), changesopts_version());
 }
 
-# return values from massage_dbp_args are one or both of these flags
-sub WANTSRC_SOURCE  () { 01; } # caller should build source (separately)
-sub WANTSRC_BUILDER () { 02; } # caller should run dpkg-buildpackage
-
 sub massage_dbp_args ($;$) {
     my ($cmd,$xargs) = @_;
     # We need to:
@@ -6249,7 +6250,7 @@ sub postbuild_mergechanges ($) {
     # or if that is undef, be a no-op.
     # Returns the changes file to report to the user.
     my $pat = changespat $version;
-    my @changesfiles = glob $pat;
+    my @changesfiles = grep { !m/_multi\.changes/ } glob $pat;
     @changesfiles = sort {
        ($b =~ m/_source\.changes$/ <=> $a =~ m/_source\.changes$/)
            or $a cmp $b
@@ -6286,7 +6287,10 @@ sub midbuild_checkchanges () {
     my $pat = changespat $version;
     return if $rmchanges;
     my @unwanted = map { s#.*/##; $_; } glob "$bpd_glob/$pat";
-    @unwanted = grep { $_ ne changespat $version,'source' } @unwanted;
+    @unwanted = grep {
+       $_ ne changespat $version,'source' and
+       $_ ne changespat $version,'multi'
+    } @unwanted;
     fail <<END
 changes files other than source matching $pat already present; building would result in ambiguity about the intended results.
 Suggest you delete @unwanted.
@@ -6407,7 +6411,8 @@ sub cmd_git_build { cmd_gbp_build(); } # compatibility with <= 1.0
 
 sub build_source_for_push {
     build_source();
-    maybe_unapply_patches_again();
+    die "er, patches are applied dirtily but shouldn't be.."
+      if $patches_applied_dirtily;
     $changesfile = $sourcechanges;
 }