summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2015-05-11 09:35:16 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2015-05-31 11:54:11 +0100
commitac3fd2f34f0e3c9555afcd8fc71b90f04b27e658 (patch)
tree6d3f9226790c4bfe40c6685bf69d08bfe98b541f
parent4950272cbef1b98c9d0e5e7b362c636473d071ee (diff)
Infra: pass $distrodir to policy hook (as yet unused, intended for config)
-rwxr-xr-xinfra/dgit-repos-policy-debian1
-rwxr-xr-xinfra/dgit-repos-server12
2 files changed, 8 insertions, 5 deletions
diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian
index 7d12b6e..1e32d39 100755
--- a/infra/dgit-repos-policy-debian
+++ b/infra/dgit-repos-policy-debian
@@ -20,6 +20,7 @@ enabledebuglevel $ENV{'DGIT_DRS_DEBUG'};
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 $distrodir = shift @ARGV // die "need DISTRO-DIR";
our $action = shift @ARGV // die "need ACTION";
our $publicmode = 02775;
diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server
index 634f91e..9387ee3 100755
--- a/infra/dgit-repos-server
+++ b/infra/dgit-repos-server
@@ -9,7 +9,7 @@
# --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)
+# (DISTRO-DIR is not used other than as default and to pass to policy hook)
# internal usage:
# .../dgit-repos-server --pre-receive-hook PACKAGE
#
@@ -117,7 +117,7 @@ $SIG{__WARN__} = sub { die $_[0]; };
# cleanup to do
#
# Policy hook script is invoked like this:
-# POLICY-HOOK-SCRIPT DISTRO DGIT-REPOS-DIR DGIT-LIVE-DIR ACTION...
+# POLICY-HOOK-SCRIPT DISTRO DGIT-REPOS-DIR DGIT-LIVE-DIR DISTRO-DIR ACTION...
# ie.
# POLICY-HOOK-SCRIPT ... check-list [...]
# POLICY-HOOK-SCRIPT ... check-package PACKAGE [...]
@@ -179,6 +179,7 @@ our $distro;
our $suitesfile;
our $policyhook;
our $dgitlive;
+our $distrodir;
our $destrepo;
our $workrepo;
our $keyrings;
@@ -270,7 +271,7 @@ sub policyhook {
my ($policyallowbits, @polargs) = @_;
# => ($exitstatuspolicybitmap);
die if $policyallowbits & ~0x3e;
- my @cmd = ($policyhook,$distro,$dgitrepos,$dgitlive,@polargs);
+ my @cmd = ($policyhook,$distro,$dgitrepos,$dgitlive,$distrodir,@polargs);
debugcmd '+',@cmd;
my $r = system @cmd;
die "system: $!" if $r < 0;
@@ -821,7 +822,8 @@ our %indistrodir = (
'dgit-live' => \$dgitlive,
);
-our @hookenvs = qw(distro suitesfile policyhook dgitlive keyrings dgitrepos);
+our @hookenvs = qw(distro suitesfile policyhook
+ dgitlive keyrings dgitrepos distrodir);
# workrepo and destrepo handled ad-hoc
@@ -919,7 +921,7 @@ sub parseargsdispatch () {
}
$distro = $ENV{'DGIT_DRS_DISTRO'} = argval();
- my $distrodir = argval();
+ $distrodir = argval();
$keyrings = $ENV{'DGIT_DRS_KEYRINGS'} = argval();
foreach my $dk (keys %indistrodir) {