diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-05-02 17:46:31 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-05-31 11:54:08 +0100 |
commit | ab3be575e6a64ca698684995a02563b3cb82f68a (patch) | |
tree | 803014c978ada2df1368fe43d3631953edc87617 /infra/dgit-repos-server | |
parent | 2d2bbb5a3356b960f18683773c6b370bcce9660f (diff) |
Implement cron mode for dgit-repos-server and corresponding code in dgit-repos-policy-debian
Diffstat (limited to 'infra/dgit-repos-server')
-rwxr-xr-x | infra/dgit-repos-server | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server index 2be40c5..f6ac507 100755 --- a/infra/dgit-repos-server +++ b/infra/dgit-repos-server @@ -25,6 +25,7 @@ # where AUTH-SPEC is one of # a # mDM.TXT +# (With --cron AUTH-SPEC is not used and may be the empty string.) use strict; $SIG{__WARN__} = sub { die $_[0]; }; @@ -154,8 +155,9 @@ $SIG{__WARN__} = sub { die $_[0]; }; # # check-list and check-package are invoked via the --cron option. # 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. +# a list of package names (one per line). 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.) @@ -164,6 +166,7 @@ $SIG{__WARN__} = sub { die $_[0]; }; use POSIX; use Fcntl qw(:flock); use File::Path qw(rmtree); +use File::Temp qw(tempfile); use Debian::Dgit qw(:DEFAULT :policyflags); @@ -864,6 +867,27 @@ sub mode_ssh () { &$mainfunc; } +sub mode_cron () { + die if @ARGV; + + my $listfh = tempfile(); + open STDOUT, ">&", $listfh or die $!; + policyhook(0,'check-list'); + open STDOUT, ">&STDERR" or die $!; + + seek $listfh, 0, 0 or die $!; + while (<$listfh>) { + chomp or die; + next if m/^\s*\#/; + next unless m/\S/; + die unless m/^($package_re)$/; + + $package = $1; + policy_checkpackage(); + } + die $! if $listfh->error; +} + sub parseargsdispatch () { die unless @ARGV; |