From 2479a589cce5c9c12044c89b3d530912efedb78e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 2 Nov 2014 16:52:29 +0000 Subject: [PATCH] config: New instead_distro feature The ssh-cmd git-check can now send us looking elsewhere. This will make migration possible. --- dgit | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dgit b/dgit index 57159b70..af710657 100755 --- a/dgit +++ b/dgit @@ -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') { -- 2.30.2