chiark / gitweb /
Introduce policy-hook script into dgit-ssh-dispatch and dgit-repos-server, but do...
[dgit.git] / infra / dgit-repos-server
index 22e6ea7987980baf245456dff135785e181be689..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,12 +95,15 @@ our $func;
 our $dgitrepos;
 our $package;
 our $suitesfile;
+our $policyhook;
 our $realdestrepo;
 our $destrepo;
 our $workrepo;
 our $keyrings;
 our @lockfhs;
 our $debug='';
+our @deliberatelies;
+our $policy;
 
 #----- utilities -----
 
@@ -336,7 +340,9 @@ sub parsetag () {
            for (;;) {
                if (s/^distro\=(\S+) //) {
                    die "$1 != $distro" unless $1 eq $distro;
-               } elsif (s/^[-+.=0-9a-z]+ //) {
+               } elsif (s/^(--deliberately-$package_re) //) {
+                   push @deliberatelies, $1;
+               } elsif (s/^[-+.=0-9a-z]\S* //) {
                } else {
                    die "unknown dgit info in tag";
                }
@@ -568,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();
@@ -583,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';