chiark / gitweb /
Introduce policy-hook script into dgit-ssh-dispatch and dgit-repos-server, but do...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 17 Mar 2015 22:35:06 +0000 (22:35 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Mar 2015 15:19:27 +0000 (15:19 +0000)
infra/dgit-repos-server
infra/dgit-ssh-dispatch

index 56fc4fd0ef766bbfd617aac8dfc34148ccfd55c2..c20eb68f54bbca1f5dde6dfbc14ae9f12d44950a 100755 (executable)
@@ -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';
 
index 88311ee37bf6cac0df28c0ab8a3fb1bdd424d2ca..ed1e6ef9924e4f421d353388d97b552fbcd0cff5 100755 (executable)
@@ -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;