summaryrefslogtreecommitdiff
path: root/infra/dgit-repos-policy-debian
diff options
context:
space:
mode:
Diffstat (limited to 'infra/dgit-repos-policy-debian')
-rwxr-xr-xinfra/dgit-repos-policy-debian34
1 files changed, 21 insertions, 13 deletions
diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian
index 5b957d3..f20572d 100755
--- a/infra/dgit-repos-policy-debian
+++ b/infra/dgit-repos-policy-debian
@@ -100,33 +100,41 @@ sub apiquery ($) {
return $r;
}
-sub specific_suite_has_vsn_in_our_history ($) {
- my ($suite) = @_;
+sub vsn_in_our_history ($) {
+ my ($vsn) = @_;
+
+ my $tagref = "refs/tags/".debiantag $vsn, $distro;
+ printdebug " checking history vsn=$vsn tagref=$tagref\n";
+ $?=0; my $r = system qw(git show-ref --verify --quiet), $tagref;
+ return 1 if !$r;
+ return 0 if $r==256;
+ die "$pkg tagref $tagref $? $!";
+}
+
+sub specific_suite_has_suitable_vsn ($$) {
+ my ($suite, $vsn_check) = @_; # tests $vsn_check->($version)
my $in_suite = apiquery "dsc_in_suite/$suite/$pkg";
foreach my $entry (@$in_suite) {
my $vsn = $entry->{version};
die "$pkg ?" unless defined $vsn;
- my $tagref = "refs/tags/".debiantag $vsn, $distro;
- printdebug " checking history suite=$suite vsn=$vsn tagref=$tagref\n";
- $?=0; my $r = system qw(git show-ref --verify --quiet), $tagref;
- return 1 if !$r;
- next if $r==256;
- die "$pkg tagref $tagref $? $!";
+ printdebug " checking history found suite=$suite vsn=$vsn\n";
+ return 1 if $vsn_check->($vsn);
}
return 0;
}
sub new_has_vsn_in_our_history () {
- return specific_suite_has_vsn_in_our_history('new');
+ return specific_suite_has_suitable_vsn('new', \&vsn_in_our_history);
}
-sub good_suite_has_vsn_in_our_history () {
+sub good_suite_has_suitable_vsn ($) {
+ my ($vsn_check) = @_; # as for specific_suite_has_specific_vsn
my $suites = apiquery "suites";
foreach my $suitei (@$suites) {
my $suite = $suitei->{name};
die unless defined $suite;
next if $suite =~ m/\bnew$/;
- return 1 if specific_suite_has_vsn_in_our_history($suite);
+ return 1 if specific_suite_has_suitable_vsn($suite, $vsn_check);
}
return 0;
}
@@ -221,7 +229,7 @@ sub check_package () {
my $age = time - $mtime;
printdebug "check_package age=$age\n";
- if (good_suite_has_vsn_in_our_history) {
+ if (good_suite_has_suitable_vsn(\&vsn_in_our_history)) {
chmod $publicmode, "." or die $!;
$pkg_secret = 0;
return 0;
@@ -412,7 +420,7 @@ END
}
if (length $freshrepo) {
- if (!good_suite_has_vsn_in_our_history()) {
+ if (!good_suite_has_suitable_vsn(\&vsn_in_our_history)) {
stat $freshrepo or die "$freshrepo $!";
my $oldmode = ((stat _)[2]);
my $oldwrites = $oldmode & 0222;