summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Debian/Dgit.pm14
-rwxr-xr-xinfra/dgit-repos-policy-debian8
-rwxr-xr-xinfra/dgit-repos-server10
3 files changed, 19 insertions, 13 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm
index 3fe0309..a124930 100644
--- a/Debian/Dgit.pm
+++ b/Debian/Dgit.pm
@@ -13,7 +13,7 @@ BEGIN {
@ISA = qw(Exporter);
@EXPORT = qw(debiantag
$package_re);
- %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
+ %EXPORT_TAGS = ( policyflags => qw() );
@EXPORT_OK = qw();
}
@@ -21,6 +21,18 @@ our @EXPORT_OK;
our $package_re = '[0-9a-z][-+.0-9a-z]*';
+
+# policy hook exit status bits
+# any unexpected bits mean failure, and then known set bits are ignored
+
+sub NOFFCHECK () { return 2; }
+# suppress dgit-repos-server's ff check ("push" only)
+
+sub FRESHREPO () { return 4; }
+# blow away repo right away (ie, as if before push or fetch)
+# ("check-package" only)
+
+
sub debiantag ($) {
my ($v) = @_;
$v =~ y/~:/_%/;
diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian
index db15310..46f1039 100755
--- a/infra/dgit-repos-policy-debian
+++ b/infra/dgit-repos-policy-debian
@@ -9,12 +9,6 @@
# dgit-repos-policy-debian ... push PACKAGE \
# VERSION SUITE TAGNAME DELIBERATELIES [...]
#
-# exit status is bitmap; bit weights (values) as follows
-# 1 failure; operation must be rejected; other bits will be ignored
-# 2 suppress dgit-repos-server's ff check ("push" only)
-# 4 blow away repo away right away (ie before push or fetch)
-# ("check-package" only)
-#
# cwd for push is a temporary repo where the to-be-pushed objects have
# been received; TAGNAME is the version-based tag
#
@@ -25,7 +19,7 @@ use strict;
use POSIX;
use JSON;
-use Debian::Dgit;
+use Debian::Dgit qw(:DEFAULT :policyflags);
our $distro = shift @ARGV // die "need DISTRO";
our $repos = shift @ARGV // die "need DGIT-REPOS-DIR";
diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server
index 6d7fb63..3f41a0b 100755
--- a/infra/dgit-repos-server
+++ b/infra/dgit-repos-server
@@ -87,7 +87,7 @@ use POSIX;
use Fcntl qw(:flock);
use File::Path qw(rmtree);
-use Debian::Dgit;
+use Debian::Dgit qw(:DEFAULT :policyflags);
open DEBUG, ">/dev/null" or die $!;
@@ -504,7 +504,7 @@ sub checks () {
debug "translated version $v";
$tagname eq "debian/$v" or die;
- my ($policy) = policyhook(2,'push',$package,
+ my ($policy) = policyhook(NOFFCHECK, 'push',$package,
$version,$suite,$tagname,
join(",",@delberatelies));
@@ -512,7 +512,7 @@ sub checks () {
# check that our ref is being fast-forwarded
debug "oldcommit $oldcommit";
- if (!($policy & 2) && $oldcommit =~ m/[^0]/) {
+ if (!($policy & NOFFCHECK) && $oldcommit =~ m/[^0]/) {
$?=0; $!=0; my $mb = `git merge-base $commit $oldcommit`;
chomp $mb;
$mb eq $oldcommit or reject "not fast forward on dgit branch";
@@ -631,8 +631,8 @@ sub parseargsdispatch () {
reject "unknown method" unless $mainfunc;
- my ($policy, $pollock) = policyhook(4, 'check-package',$package);
- if ($policy & 4) {
+ my ($policy, $pollock) = policyhook(FRESHREPO,'check-package',$package);
+ if ($policy & FRESHREPO) {
my $garbagerepo = "$dgitrepos/_tmp/${package}_garbage";
acquiretree($garbagerepo,1);
rmtree $garbagerepo;