X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=d771ce1067d20973b98e31335881ad78d1526707;hp=ca343afc87f911fb832a1b0f0b79182f075dd6f4;hb=3376567f79945be76fedff825e0512eebab311ef;hpb=2799e120b5cfa0ff9f942304f86d8024753bbc70 diff --git a/dgit b/dgit index ca343afc..d771ce10 100755 --- a/dgit +++ b/dgit @@ -78,7 +78,7 @@ our $patches_applied_dirtily = 00; our $tagformat_want; our $tagformat; our $tagformatfn; -our $chase_dsc_distro=1; #xxx configurable +our $chase_dsc_distro=1; our %forceopts = map { $_=>0 } qw(unrepresentable unsupported-source-format @@ -664,6 +664,7 @@ sub git_get_config ($) { my ($c) = @_; foreach my $src (@gitcfgsources) { my $l = $gitcfgs{$src}{$c}; + croak "$l $c" if $l && !ref $l; printdebug"C $c ".(defined $l ? join " ", map { messagequote "'$_'" } @$l : "undef")."\n" @@ -679,6 +680,7 @@ sub git_get_config ($) { sub cfg { foreach my $c (@_) { return undef if $c =~ /RETURN-UNDEF/; + printdebug "C? $c\n" if $debuglevel >= 5; my $v = git_get_config($c); return $v if defined $v; my $dv = $defcfg{$c}; @@ -691,7 +693,7 @@ sub cfg { "$us: distro or suite appears not to be (properly) supported"; } -sub access_basedistro () { +sub access_basedistro__noalias () { if (defined $idistro) { return $idistro; } else { @@ -711,6 +713,12 @@ sub access_basedistro () { } } +sub access_basedistro () { + my $noalias = access_basedistro__noalias(); + my $canon = cfg("dgit-distro.$noalias.alias-canon",'RETURN-UNDEF'); + return $canon // $noalias; +} + sub access_nomdistro () { my $base = access_basedistro(); my $r = cfg("dgit-distro.$base.nominal-distro",'RETURN-UNDEF') // $base; @@ -2769,7 +2777,8 @@ sub resolve_dsc_field_commit ($$) { return unless defined $dsc_hash; my $mapref = - $already_distro eq $dsc_distro || !$chase_dsc_distro + defined $already_mapref && + ($already_distro eq $dsc_distro || !$chase_dsc_distro) ? $already_mapref : undef; my $do_fetch; @@ -6022,11 +6031,16 @@ sub cmd_import_dsc { parse_dscdata(); - parse_dsc_field($dsc, "Dgit metadata in .dsc"); + $package = getfield $dsc, 'Source'; + + parse_dsc_field($dsc, "Dgit metadata in .dsc") + unless forceing [qw(import-dsc-with-dgit-field)]; - if (defined $dsc_hash - && !forceing [qw(import-dsc-with-dgit-field)]) { + if (defined $dsc_hash) { progress "dgit: import-dsc of .dsc with Dgit field, using git hash"; + resolve_dsc_field_commit undef, undef; + } + if (defined $dsc_hash) { my @cmd = (qw(sh -ec), "echo $dsc_hash | git cat-file --batch-check"); my $objgot = cmdoutput @cmd; @@ -6058,7 +6072,6 @@ Specify +$specbranch to overwrite, discarding existing history END if $oldhash && !$force; - $package = getfield $dsc, 'Source'; my @dfi = dsc_files_info(); foreach my $fi (@dfi) { my $f = $fi->{Filename}; @@ -6264,6 +6277,9 @@ sub parseopts () { } elsif (m/^--no-rm-on-error$/s) { push @ropts, $_; $rmonerror = 0; + } elsif (m/^--no-chase-dsc-distro$/s) { + push @ropts, $_; + $chase_dsc_distro = 0; } elsif (m/^--overwrite$/s) { push @ropts, $_; $overwrite_version = ''; @@ -6309,6 +6325,11 @@ sub parseopts () { # undocumented, for testing push @ropts, $_; $need_split_build_invocation = 1; + } elsif (m/^--config-lookup-explode=(.+)$/s) { + # undocumented, for testing + push @ropts, $_; + $gitcfgs{cmdline}{$1} = 'CONFIG-LOOKUP-EXPLODE'; + # ^ it's supposed to be an array ref } elsif (m/^(--[-0-9a-z]+)(=|$)/ && ($oi = $valopts_long{$1})) { $val = $2 ? $' : undef; #'; $valopt->($oi->{Long});