X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=infra%2Fdgit-ssh-dispatch;h=9c023d80859fecd63cbc6ca64dfc925818bfc473;hp=f5250555bb44ad3ce8cb1c8e5b00ef50ac4a28e3;hb=5cbfd93057610740cf7954ce3d29a2d14bacd603;hpb=16570fa6d2c817138272294ac143db1252376ba8 diff --git a/infra/dgit-ssh-dispatch b/infra/dgit-ssh-dispatch index f5250555..9c023d80 100755 --- a/infra/dgit-ssh-dispatch +++ b/infra/dgit-ssh-dispatch @@ -22,7 +22,7 @@ our $lre = $package_re; our $qre = '["'."']?"; # $dispatchdir/distro=DISTRO should contain -# dgit-live a clone of dgit +# dgit-live a clone of dgit (only if not using installed vsns) # diverts # repos/ } by virtue of # suites } dgit-repos-server's defaults relating to @@ -32,6 +32,7 @@ our $qre = '["'."']?"; # diverts should be list of # [] # where is a package name pattern which may contain * or literals. +# is for `git config dgit-distro.DISTRO.diverts.' our ($distro,$pkg, $d); our ($dgitlive,$repos,$suites,$diverts,$policyhook,$repo); @@ -118,7 +119,7 @@ sub serve_up ($) { } sub dispatch () { - local ($_) = $ENV{'SSH_ORIGINAL_COMMAND'}; + local ($_) = $ENV{'SSH_ORIGINAL_COMMAND'} // ''; if (m#^: dgit ($lre) git-check ($lre) ;#) { selectpackage $1,$2, sub { prl "divert @_"; finish; }; @@ -134,6 +135,7 @@ sub dispatch () { $ENV{'PERLLIB'} =~ s#^(?=.)#:#; $ENV{'PERLLIB'} =~ s#^# $ENV{DGIT_TEST_INTREE} // $dgitlive #e; my $s = "$dgitlive/infra/dgit-repos-server"; + $s = "dgit-repos-server" if !stat_exists $s; exec $s, $distro, $d, $authrune, qw(--ssh); die "exec $s: $!"; } elsif ($cmd eq 'upload-pack') { @@ -146,6 +148,8 @@ sub dispatch () { m#^${qre}git-upload-pack ${qre}/dgit/($lre)/(?:repos/)?_dgit-repos-server\.git${qre}$# ) { my $distro= $1; + # if running installed packages, source code should come + # some other way serve_up("$dispatchdir/distro=$1/dgit-live/.git"); } elsif (m#^${qre}git-upload-pack\s#) { die "unknown repo to serve ($_). use dgit, or for server source ".