summaryrefslogtreecommitdiff
path: root/infra/dgit-ssh-dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'infra/dgit-ssh-dispatch')
-rwxr-xr-xinfra/dgit-ssh-dispatch20
1 files changed, 17 insertions, 3 deletions
diff --git a/infra/dgit-ssh-dispatch b/infra/dgit-ssh-dispatch
index c5861d2..e63d4bf 100755
--- a/infra/dgit-ssh-dispatch
+++ b/infra/dgit-ssh-dispatch
@@ -137,6 +137,12 @@ sub serve_up ($) {
die "exec git: $!";
}
+sub perllib_local () {
+ $ENV{'PERLLIB'} //= '';
+ $ENV{'PERLLIB'} =~ s#^(?=.)#:#;
+ $ENV{'PERLLIB'} =~ s#^# $ENV{DGIT_TEST_INTREE} // $dgitlive #e;
+}
+
sub dispatch () {
local ($_) = $ENV{'SSH_ORIGINAL_COMMAND'} // '';
@@ -150,9 +156,7 @@ sub dispatch () {
my $cmd=$1;
selectpackage $2,$3;
if ($cmd eq 'receive-pack') {
- $ENV{'PERLLIB'} //= '';
- $ENV{'PERLLIB'} =~ s#^(?=.)#:#;
- $ENV{'PERLLIB'} =~ s#^# $ENV{DGIT_TEST_INTREE} // $dgitlive #e;
+ perllib_local();
my $s = "$dgitlive/infra/dgit-repos-server";
$s = "dgit-repos-server" if !stat_exists $s;
exec $s, $distro, $d, $authrune, qw(--ssh);
@@ -173,6 +177,16 @@ sub dispatch () {
} elsif (m#^${qre}git-upload-pack\s#) {
die "unknown repo to serve ($_). use dgit, or for server source ".
"git clone here:/dgit/DISTRO/repos/_dgit-repos-server.git";
+ } elsif (m#^: dgit ($lre) policy-client-query ($lre) ($lre) ([^;]*) ;#) {
+ my $query_op = $3;
+ my $query_args = $4;
+ selectpackage $1,$2;
+ my @cmd = ($policyhook,$distro,$repos,$dgitlive,$d,
+ 'policy-client-query', $pkg, $query_op,
+ split / /, $query_args);
+ perllib_local();
+ exec @cmd;;
+ die "exec $cmd[0]: $!";
} else {
die "unsupported operation ($_)";
}