From 1fa06b624c0576b0b102fb4617ae15e8d993fb09 Mon Sep 17 00:00:00 2001 From: Marcelo Leitner Date: Thu, 15 Mar 2007 12:36:35 +0000 Subject: - Fixed version_freeze mode: do not allow any upload with a different version from what is already present on the repository. - Added an ACL control for maintainers allowed to bypass this restriction as option authorized_users. --- lib/Youri/Submit/Check/Version.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib/Youri') diff --git a/lib/Youri/Submit/Check/Version.pm b/lib/Youri/Submit/Check/Version.pm index 0035e7a..289ffe0 100644 --- a/lib/Youri/Submit/Check/Version.pm +++ b/lib/Youri/Submit/Check/Version.pm @@ -40,7 +40,21 @@ sub run { my $arch = $repository->get_arch($package, $target, $define); return if $arch =~ /$opt->{authorized_arches}/; if ($opt->{mode} eq 'version_freeze') { - return if $section =~ /$opt->{authorized_sections}/ + return if $section =~ /$opt->{authorized_sections}/; + my $user = $define->{user}; + return if $user =~ /$opt->{authorized_users}/; + my ($package_version) = $package =~ /-([^-]+)-[^-]+\.src$/; + $define->{arch} = 'src'; + my @revisions = $repository->get_revisions($package, $target, $define, undef, + sub { + my ($version) = $_[0] =~ /-([^-]+)-[^-]+\.src$/; + URPM::ranges_overlap("== $version", "< $package_version") + } + ); + $define->{arch} = ''; + if (@revisions) { + return "FREEZE, package @revisions of different versions exist in $target\n"; + } } # FIXME: The following code is not working and must be reviewed. elsif ($opt->{mode} eq 'freeze') { -- cgit v1.2.1