chiark / gitweb /
dgit: build_source: drop call to build_prep
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 26 Jul 2018 07:09:32 +0000 (08:09 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 26 Jul 2018 10:17:21 +0000 (11:17 +0100)
We want the callers to do this so they can control it better.  They
mostly already do.  In detail:

* cmd_push_source

  This one is most complicated.  It already calls prep_push, which
  does a variety of things which overlap with build_prep.  The things
  which are in build_prep but not in prep_push are:
   - notpushing (via build_prep_early), which seems to be a mistake
   - clean_tree(), which is needed, so we add it (for now...)
   - build_maybe_quilt_fixup, which is needed, so we add it
   - remove old changes, which is not actually needed

* cmd_build, cmd_gbp_build

  build_prep was already called by the if arm which didn't call
  build_source; so we can just move it up outside the if.  No
  functional change here.

* cmd_build_source, cmd_sbuild

  We need to replace the call.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
dgit

diff --git a/dgit b/dgit
index d948e622cb53d7ff8d381e03d43b239d4c08ee70..db52f91ef04a04c4deb2179c04f006bf1cb02975 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -4762,6 +4762,8 @@ sub cmd_push_source {
     prep_push();
     fail "dgit push-source: --include-dirty/--ignore-dirty does not make".
       "sense with push-source!" if $includedirty;
+    clean_tree();
+    build_maybe_quilt_fixup();
     if ($changesfile) {
         my $changes = parsecontrol("$buildproductsdir/$changesfile",
                                    "source changes file");
@@ -6321,11 +6323,10 @@ sub cmd_build {
     build_prep_early();
     my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts_initial(), @ARGV);
     my $wantsrc = massage_dbp_args \@dbp;
+    build_prep();
     if ($wantsrc & WANTSRC_SOURCE) {
        build_source();
        midbuild_checkchanges_vanilla $wantsrc;
-    } else {
-       build_prep();
     }
     if ($wantsrc & WANTSRC_BUILDER) {
        push @dbp, changesopts_version();
@@ -6394,6 +6395,7 @@ sub cmd_gbp_build {
        }
     }
 
+    build_prep();
     if ($wantsrc & WANTSRC_SOURCE) {
        build_source();
        midbuild_checkchanges_vanilla $wantsrc;
@@ -6401,7 +6403,6 @@ sub cmd_gbp_build {
        if (!$clean_using_builder) {
            push @cmd, '--git-cleaner=true';
        }
-       build_prep();
     }
     maybe_unapply_patches_again();
     if ($wantsrc & WANTSRC_BUILDER) {
@@ -6413,7 +6414,6 @@ sub cmd_gbp_build {
 sub cmd_git_build { cmd_gbp_build(); } # compatibility with <= 1.0
 
 sub build_source {
-    build_prep();
     $sourcechanges = changespat $version,'source';
     if (act_local()) {
        unlink "$buildproductsdir/$sourcechanges" or $!==ENOENT
@@ -6450,14 +6450,15 @@ sub build_source {
 }
 
 sub cmd_build_source {
-    build_prep_early();
     badusage "build-source takes no additional arguments" if @ARGV;
+    build_prep();
     build_source();
     maybe_unapply_patches_again();
     printdone "source built, results in $dscfn and $sourcechanges";
 }
 
 sub cmd_sbuild {
+    build_prep(); # not BUILDER because sbuild uses the .dsc
     build_source();
     midbuild_checkchanges();
     in_bpd {