X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=Debian%2FDgit.pm;h=8b29ba2746be30267b9cef7cf73ff60b3d95e25e;hb=8afbacc6da4ad5ccaf931d113df175bef22cc7b1;hp=2be936b87c6a6d3dd23e4acc7664ef2e7dfd2bca;hpb=1f0e14f2af07576c71e674a946b84f60f594e653;p=dgit.git diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 2be936b8..8b29ba27 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -11,17 +11,44 @@ BEGIN { $VERSION = 1.00; @ISA = qw(Exporter); - @EXPORT = qw(debiantag); - %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], + @EXPORT = qw(debiantag server_branch server_ref + stat_exists + $package_re $branchprefix); + %EXPORT_TAGS = ( policyflags => qw() ); @EXPORT_OK = qw(); } our @EXPORT_OK; +our $package_re = '[0-9a-z][-+.0-9a-z]*'; +our $branchprefix = 'dgit'; + + +# 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" and "push" only) + + sub debiantag ($) { my ($v) = @_; $v =~ y/~:/_%/; return "debian/$v"; } +sub server_branch ($) { return "$branchprefix/$_[0]"; } +sub server_ref ($) { return "refs/".server_branch($_[0]); } + +sub stat_exists ($) { + my ($f) = @_; + return 1 if stat $f; + return 0 if $!==&ENOENT; + die "stat $f: $!"; +} + 1;