diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2014-11-02 16:52:29 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2014-11-08 22:22:20 +0000 |
commit | 2479a589cce5c9c12044c89b3d530912efedb78e (patch) | |
tree | 4c823b1c383549a7a6e1ee8000dc40ea881c8277 /dgit | |
parent | 25668656cea95fdbf219cb51c0b657d188b7077e (diff) |
config: New instead_distro feature
The ssh-cmd git-check can now send us looking elsewhere. This will
make migration possible.
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -102,6 +102,7 @@ our $remotename = 'dgit'; our @ourdscfield = qw(Dgit Vcs-Dgit-Master); our $branchprefix = 'dgit'; our $csuite; +our $instead_distro; sub lbranch () { return "$branchprefix/$csuite"; } my $lbranch_re = '^refs/heads/'.$branchprefix.'/([^/.]+)$'; @@ -595,6 +596,7 @@ sub access_distros () { # Returns list of distros to try, in order # # We want to try: + # 0. `instead of' distro name(s) we have been pointed to # 1. the access_quirk distro, if any # 2a. the user's specified distro, or failing that } basedistro # 2b. the distro calculated from the suite } @@ -602,6 +604,7 @@ sub access_distros () { my (undef,$quirkdistro) = access_quirk(); unshift @l, $quirkdistro; + unshift @l, $instead_distro; return grep { defined } @l; } @@ -975,6 +978,7 @@ sub get_archive_dsc () { $dsc = undef; } +sub check_for_git (); sub check_for_git () { # returns 0 or 1 my $how = access_cfg('git-check'); @@ -985,6 +989,14 @@ sub check_for_git () { " set -e; cd ".access_cfg('git-path').";". " if test -d $package.git; then echo 1; else echo 0; fi"); my $r= cmdoutput @cmd; + if ($r =~ m/^divert (\w+)$/) { + my $divert=$1; + my ($usedistro,) = access_distros(); + $instead_distro= cfg("dgit-distro.$usedistro.diverts.$divert"); + $instead_distro =~ s{^/}{ access_basedistro()."/" }e; + printdebug "diverting $divert so using distro $instead_distro\n"; + return check_for_git(); + } failedcmd @cmd unless $r =~ m/^[01]$/; return $r+0; } elsif ($how eq 'true') { |