chiark / gitweb /
Policy hook protocol: pass dgit live directory (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 2 May 2015 15:52:09 +0000 (16:52 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:54:07 +0000 (11:54 +0100)
infra/dgit-repos-policy-debian
infra/dgit-repos-server

index 88eb4fce20c3285412781d82cc216839f312af2d..0c7d8887fe153152d9e877b0f27e95cf718e3b9e 100755 (executable)
@@ -15,6 +15,7 @@ use Debian::Dgit::Policy::Debian;
 
 our $distro = shift @ARGV // die "need DISTRO";
 our $repos = shift @ARGV // die "need DGIT-REPOS-DIR";
+our $dgitlive = shift @ARGV // die "need DGIT-LIVE-DIR";
 our $action = shift @ARGV // die "need ACTION";
 
 our $publicmode = 02775;
index 515501460a3ffb944fcb2ee4fb3049956922e403..0d55aa133b01679ffaeb5b6d88d01d2ae2189964 100755 (executable)
@@ -8,6 +8,7 @@
 #   --repos=GIT-REPOS-DIR      default DISTRO-DIR/repos/
 #   --suites=SUITES-FILE       default DISTRO-DIR/suites
 #   --policy-hook=POLICY-HOOK  default DISTRO-DIR/policy-hook
+#   --dgit-live=DGIT-LIVE-DIR  default DISTRO-DIR/dgit-live
 # (DISTRO-DIR is not used other than as default)
 # internal usage:
 #  .../dgit-repos-server --pre-receive-hook PACKAGE
@@ -115,7 +116,7 @@ $SIG{__WARN__} = sub { die $_[0]; };
 #    cleanup to do
 #
 # Policy hook script is invoked like this:
-#   POLICY-HOOK-SCRIPT DISTRO DGIT-REPOS-DIR ACTION...
+#   POLICY-HOOK-SCRIPT DISTRO DGIT-REPOS-DIR DGIT-LIVE-DIR ACTION...
 # ie.
 #   POLICY-HOOK-SCRIPT ... check-list [...]
 #   POLICY-HOOK-SCRIPT ... check-package PACKAGE [...]
@@ -146,6 +147,9 @@ $SIG{__WARN__} = sub { die $_[0]; };
 # First, without any locking, check-list is called.  It should produce
 # a list of package names.  Then check-package will be invoked for
 # each named package, in each case after taking an appropriate lock.
+#
+# If policy hook wants to run dgit (or something else in the dgit
+# package), it should use DGIT-LIVE-DIR/dgit (etc.)
 
 
 use POSIX;
@@ -162,6 +166,7 @@ our $package;
 our $distro;
 our $suitesfile;
 our $policyhook;
+our $dgitlive;
 our $destrepo;
 our $workrepo;
 our $keyrings;
@@ -266,11 +271,12 @@ sub policyhook {
     my ($policyallowbits, @polargs) = @_;
     # => ($exitstatuspolicybitmap);
     die if $policyallowbits & ~0x3e;
-    my @cmd = ($policyhook,$distro,$dgitrepos,@polargs);
+    my @cmd = ($policyhook,$distro,$dgitrepos,$dgitlive,@polargs);
     debugcmd @cmd;
     my $r = system @cmd;
     die "system: $!" if $r < 0;
     die "hook (@cmd) failed ($?)" if $r & ~($policyallowbits << 8);
+    debug sprintf "hook (%s) => %#x", "@polargs", $r;
     return $r >> 8;
 }
 
@@ -793,9 +799,10 @@ our %indistrodir = (
     'repos' => \$dgitrepos,
     'suites' => \$suitesfile,
     'policy-hook' => \$policyhook,
+    'dgit-live' => \$dgitlive,
     );
 
-our @hookenvs = qw(distro suitesfile policyhook keyrings dgitrepos);
+our @hookenvs = qw(distro suitesfile policyhook dgitlive keyrings dgitrepos);
 
 # workrepo and destrepo handled ad-hoc