From: Ian Jackson Date: Sat, 7 Jan 2017 16:41:56 +0000 (+0000) Subject: dgit: Option parsing: Fix distro/suite reference bugs X-Git-Tag: archive/debian/3.0~85 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=81a31ed44401d58cff028c12db896fa3badfd4ee dgit: Option parsing: Fix distro/suite reference bugs 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 --- diff --git a/debian/changelog b/debian/changelog index ed1128ea..b72ac69e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 5207e0b9..88bd431a 100755 --- 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->();