chiark / gitweb /
dgit: Option parsing: Fix undefined $suite in some import-dsc.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 13 Jan 2017 13:50:15 +0000 (13:50 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 13 Jan 2017 18:32:23 +0000 (18:32 +0000)
* Set $isuite to a dummy value.  In import-dsc we aren't operating on
  a suite.  We have to set it to something (because the config likes
  to look at the suite) and this avoids picking up information
  relating to the default suite.

* Set $idistro (if -d not supplied) to the distro from (or implied by)
  the .dsc.  This is needed so that we do not use any config from the
  default distro.  In particular, the default commands (like what
  `git' command to use to access the dgit git server) need to be found
  via the dsc's distro's cmd-git setting, and this is done by
  parseopts_late_defaults() in pushing().  So we must set $idistro
  before then.

* Move notpushing earlier, so that we call it before we call
  resolve_dsc_field_commit().  (It doesn't matter there for $idistro,
  because it sets that itself, but the git command does.)

Closes:#851213.

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

index 4d0b59ae593c2ae68092cec56e2b63cc1baa048f..04328fe5fff8fa263be123bf2a2012cf3dbca866 100644 (file)
@@ -4,6 +4,8 @@ dgit (3.3~) unstable; urgency=medium
   * dgit: Remove a leftover debugging print.
   * dgit: Set default dsc import distro when there is no Dgit field.
   * dgit: Set default dsc import distro when suppressing Dgit field.
+  * dgit: Option parsing: Fix undefined $suite in some import-dsc.
+    Closes:#851213.
 
   Packaging:
   * Remove redundant Recommends on libtext-iconv-perl.
diff --git a/dgit b/dgit
index f4a470d941449916b965b56113968dde52950f62..4b088dbc316f0e8f2a3fa0d3a922895eadfd3457 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -6119,6 +6119,11 @@ sub cmd_import_dsc {
        unless forceing [qw(import-dsc-with-dgit-field)];
     parse_dsc_field_def_dsc_distro();
 
+    $isuite = 'DGIT-IMPORT-DSC';
+    $idistro //= $dsc_distro;
+
+    notpushing();
+
     if (defined $dsc_hash) {
        progress "dgit: import-dsc of .dsc with Dgit field, using git hash";
        resolve_dsc_field_commit undef, undef;
@@ -6155,8 +6160,6 @@ Specify  +$specbranch to overwrite, discarding existing history
 END
        if $oldhash && !$force;
 
-    notpushing();
-
     my @dfi = dsc_files_info();
     foreach my $fi (@dfi) {
        my $f = $fi->{Filename};