diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2022-12-26 23:38:21 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2022-12-27 19:19:31 +0000 |
commit | b1fc3bb4bae23b368a697c8eaeb82f68e66e1805 (patch) | |
tree | 19619677153419709c08379c8fe858d7aa09aa11 | |
parent | 74b799af1adbbda7f2cd3f9c0fd9bf2bad2b179c (diff) |
policy-client-query: implement dispatcher in dgit-repos-policy-debian
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-x | infra/dgit-repos-policy-debian | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian index 35c719a..3722833 100755 --- a/infra/dgit-repos-policy-debian +++ b/infra/dgit-repos-policy-debian @@ -512,11 +512,21 @@ sub action_check_list () { return 0; } -$action =~ y/-/_/; -my $fn = ${*::}{"action_$action"}; +my $fn_name; + +if ($action eq 'policy-client-query') { + getpackage(); + my $query = shift @ARGV // die "need QUERY-OP"; + $fn_name = "polclqu_$query"; +} else { + $fn_name = "action_$action"; +} +$fn_name =~ y/-/_/; +my $fn = ${*::}{$fn_name}; + if (!$fn) { - printdebug "dgit-repos-policy-debian: unknown action $action\n"; - exit 0; + printdebug "dgit-repos-policy-debian: unknown $fn_name\n"; + _exit 0; } my $sleepy=0; @@ -543,10 +553,16 @@ for (;;) { $stderr = ''; $rcode = $fn->(); - die unless defined $rcode; - $poldbh->commit; - printdebug "poldbh commit\n"; + if ($action eq 'policy-client-query') { + close STDOUT or die $!; + _exit 0; + } else { + die unless defined $rcode; + + $poldbh->commit; + printdebug "poldbh commit\n"; + } }; last unless length $@; die $@ unless ref $@ eq $db_busy_exception; |