X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=Debian%2FDgit.pm;h=1ab65a8f24c6fd1da07d25bd03e1916f81f16f4d;hp=6932d14a7d07f32ae57a8ef4005643c4be1ea903;hb=f08a465fb0a346019750c62dd6cdf1eed348e032;hpb=d395baaa070686dce79a9ad7cd02777a4caa4778 diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 6932d14a..1ab65a8f 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -1,10 +1,12 @@ -# +# -*- perl -*- package Debian::Dgit; use strict; use warnings; +use POSIX; + BEGIN { use Exporter (); our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); @@ -13,22 +15,23 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw(debiantag server_branch server_ref stat_exists git_for_each_ref - $package_re $branchprefix); - %EXPORT_TAGS = ( policyflags => qw() ); - @EXPORT_OK = qw(); + $package_re $component_re $branchprefix); + %EXPORT_TAGS = ( policyflags => [qw(NOFFCHECK FRESHREPO)] ); + @EXPORT_OK = @{ $EXPORT_TAGS{policyflags} }; } our @EXPORT_OK; our $package_re = '[0-9a-z][-+.0-9a-z]*'; +our $component_re = '[0-9a-zA-Z][-+.0-9a-zA-Z]*'; our $branchprefix = 'dgit'; # policy hook exit status bits # see dgit-repos-server head comment for documentation # 1 is reserved in case something fails with `exit 1' -sub NOFFCHECK () { return 2; } -sub FRESHREPO () { return 4; } -# 128 is reserved +sub NOFFCHECK () { return 0x2; } +sub FRESHREPO () { return 0x4; } +# 0x80 is reserved sub debiantag ($) { my ($v) = @_; @@ -51,7 +54,7 @@ sub git_for_each_ref ($$) { # calls $func->($objid,$objtype,$fullrefname,$reftail); # $reftail is RHS of ref after refs/\w+/ # breaks if $pattern matches any ref `refs/blah' where blah has no `/' - my $fh = new IO::File, "-|", qw(git for-each-ref), $pattern or die $!; + my $fh = new IO::File "-|", qw(git for-each-ref), $pattern or die $!; while (<$fh>) { m#^(\w+)\s+(\w+)\s+(refs/\w+/(\S+))\s# or die "$_ ?"; $func->($1,$2,$3,$4);