chiark / gitweb /
dgit: Option parsing: Fix distro/suite reference bugs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Jan 2017 16:41:56 +0000 (16:41 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 8 Jan 2017 22:14:48 +0000 (22:14 +0000)
By moving parseopts_late_defaults call.

This is conceptually the same as finalise_late_opts, so do it there.
We have to add a missing call to build_prep_early, as otherwise we
call massage_dbp_args too soon.

Also move a nopushing() call until after $isuite is set

All of this means that we now honour $isuite (and sometimes $idistro)
much better.

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

index ed1128ea4ac767224bb95343f5fdf5cf0995c24a..b72ac69e7d373464eaa6e2d820e3119bd41f5a1e 100644 (file)
@@ -1,5 +1,9 @@
 dgit (2.17~) unstable; urgency=medium
 
+  Bugfixes:
+  * dgit config handling: Honour command-line and context-provided
+    suite and distro more reliably and consistently.
+
   dgit-badcommit-fixup: 
   * Do not investigate symrefs.  Closes:#850547.
 
diff --git a/dgit b/dgit
index 5207e0b96780124fbb106843e51f0fd4b3fe1ba3..88bd431ab37e277bcd273079a2f6fc42078e3030 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -143,6 +143,7 @@ our %opts_cfg_insertpos = map {
 } keys %opts_opt_map;
 
 sub finalise_opts_opts();
+sub parseopts_late_defaults();
 
 our $keyid;
 
@@ -4076,7 +4077,6 @@ END
 
 sub cmd_clone {
     parseopts();
-    notpushing();
     my $dstdir;
     badusage "-p is not allowed with clone; specify as argument instead"
        if defined $package;
@@ -4091,8 +4091,9 @@ sub cmd_clone {
     } else {
        badusage "incorrect arguments to dgit clone";
     }
-    $dstdir ||= "$package";
+    notpushing();
 
+    $dstdir ||= "$package";
     if (stat_exists $dstdir) {
        fail "$dstdir already exists";
     }
@@ -5637,6 +5638,7 @@ sub postbuild_mergechanges_vanilla ($) {
 }
 
 sub cmd_build {
+    build_prep_early();
     my @dbp = (@dpkgbuildpackage, qw(-us -uc), changesopts_initial(), @ARGV);
     my $wantsrc = massage_dbp_args \@dbp;
     if ($wantsrc > 0) {
@@ -5790,6 +5792,7 @@ sub build_source {
 }
 
 sub cmd_build_source {
+    build_prep_early();
     badusage "build-source takes no additional arguments" if @ARGV;
     build_source();
     maybe_unapply_patches_again();
@@ -6289,6 +6292,8 @@ sub finalise_opts_opts () {
                     @$om[$insertpos..$#$om] );
        }
     }
+
+    parseopts_late_defaults();
 }
 
 if ($ENV{$fakeeditorenv}) {
@@ -6349,8 +6354,6 @@ sub parseopts_late_defaults () {
     }
 }
 
-parseopts_late_defaults();
-
 my $fn = ${*::}{"cmd_$cmd"};
 $fn or badusage "unknown operation $cmd";
 $fn->();