summaryrefslogtreecommitdiff
path: root/infra
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-03-17 22:35:06 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-03-22 15:19:27 +0000
commit772fdc0dc3733838b2efdf0c9af7252c2eafafd8 (patch)
treea98e0be9d0d008d062eb58d150a3e9bb4a25e487 /infra
parenteab588a83905122af678182876c2f800e4b6fa77 (diff)
Introduce policy-hook script into dgit-ssh-dispatch and dgit-repos-server, but do not supply one yet
Diffstat (limited to 'infra')
-rwxr-xr-xinfra/dgit-repos-server6
-rwxr-xr-xinfra/dgit-ssh-dispatch7
2 files changed, 10 insertions, 3 deletions
diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server
index 56fc4fd..c20eb68 100755
--- a/infra/dgit-repos-server
+++ b/infra/dgit-repos-server
@@ -2,7 +2,8 @@
# dgit-repos-server
#
# usages:
-# .../dgit-repos-server DISTRO SUITES KEYRING-AUTH-SPEC DGIT-REPOS-DIR --ssh
+# .../dgit-repos-server DISTRO SUITES KEYRING-AUTH-SPEC \
+# DGIT-REPOS-DIR POLICY-HOOK-SCRIPT --ssh
# internal usage:
# .../dgit-repos-server --pre-receive-hook PACKAGE
#
@@ -94,6 +95,7 @@ our $func;
our $dgitrepos;
our $package;
our $suitesfile;
+our $policyhook;
our $realdestrepo;
our $destrepo;
our $workrepo;
@@ -572,6 +574,7 @@ sub parseargsdispatch () {
defined($workrepo = $ENV{'DGIT_DRS_WORK'}) or die;
defined($destrepo = $ENV{'DGIT_DRS_DEST'}) or die;
defined($keyrings = $ENV{'DGIT_DRS_KEYRINGS'}) or die $!;
+ defined($policyhook = $ENV{'DGIT_DRS_POLICYHOOK'}) or die $!;
open STDOUT, ">&STDERR" or die $!;
eval {
stunthook();
@@ -587,6 +590,7 @@ sub parseargsdispatch () {
$ENV{'DGIT_DRS_SUITES'} = argval();
$ENV{'DGIT_DRS_KEYRINGS'} = argval();
$dgitrepos = argval();
+ $ENV{'DGIT_DRS_POLICYHOOK'} = $policyhook = argval();
die unless @ARGV==1 && $ARGV[0] eq '--ssh';
diff --git a/infra/dgit-ssh-dispatch b/infra/dgit-ssh-dispatch
index 88311ee..ed1e6ef 100755
--- a/infra/dgit-ssh-dispatch
+++ b/infra/dgit-ssh-dispatch
@@ -24,6 +24,7 @@ our $qre = '["'."']?";
# repos/
# suites
# diverts
+# policy-hook
# plus files required by the authrune (by default, keyrings/ and dm.txt)
#
# diverts should be list of
@@ -31,7 +32,7 @@ our $qre = '["'."']?";
# where <pat> is a package name pattern which may contain * or literals.
our ($distro,$pkg);
-our ($dgitlive,$repos,$suites,$diverts,$repo);
+our ($dgitlive,$repos,$suites,$diverts,$policyhook,$repo);
sub checkdivert ($) {
my ($df) = @_;
@@ -80,6 +81,7 @@ sub selectpackage ($$;$) {
$dgitlive= "$d/dgit-live";
$repos= "$d/repos";
$suites= "$d/suites";
+ $policyhook= "$d/policy-hook";
$authrune =~ s/\@/$d/g;
@@ -121,7 +123,8 @@ sub dispatch () {
selectpackage $2,$3;
if ($cmd eq 'receive-pack') {
my $s = "$dgitlive/infra/dgit-repos-server";
- exec $s, $distro, $suites, $authrune, $repos, qw(--ssh);
+ exec $s, $distro, $suites, $authrune, $repos,
+ $policyhook, qw(--ssh);
die "exec $s: $!";
} elsif ($cmd eq 'upload-pack') {
$repo='$repos/_empty' unless hasrepo;