aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2006-09-01 10:04:02 +0000
committerFlorent Villard <warly@mandriva.com>2006-09-01 10:04:02 +0000
commitab953b7c5729c09e2e04e82dc029c00178333e97 (patch)
treefe84d9aee61795ca95586ed8e7c3dae311bd79e3
parent9f371a2af71658a117fbffff07606bdff9e963ce (diff)
downloadmga-youri-core-ab953b7c5729c09e2e04e82dc029c00178333e97.tar
mga-youri-core-ab953b7c5729c09e2e04e82dc029c00178333e97.tar.gz
mga-youri-core-ab953b7c5729c09e2e04e82dc029c00178333e97.tar.bz2
mga-youri-core-ab953b7c5729c09e2e04e82dc029c00178333e97.tar.xz
mga-youri-core-ab953b7c5729c09e2e04e82dc029c00178333e97.zip
add check for version for freeze
-rw-r--r--lib/Youri/Upload/Check/Version.pm59
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/Youri/Upload/Check/Version.pm b/lib/Youri/Upload/Check/Version.pm
new file mode 100644
index 0000000..42dfe41
--- /dev/null
+++ b/lib/Youri/Upload/Check/Version.pm
@@ -0,0 +1,59 @@
+# $Id: /youri.mdv/trunk/lib/Youri/Upload/Check/Recency.pm 975 2006-08-05T08:30:57.188281Z warly $
+package Youri::Upload::Check::Version;
+
+=head1 NAME
+
+Youri::Upload::Check::Recency - Release check against current target
+
+=head1 DESCRIPTION
+
+This check plugin rejects packages whose a current or newer revision already
+exists for current upload target.
+
+=cut
+
+use warnings;
+use strict;
+use Carp;
+use base qw/Youri::Upload::Check/;
+
+sub _init {
+ my $self = shift;
+ my %options = (
+ authorized_media => undef, # expected tag values
+ authorized_packages => undef, # expected tag values
+ @_
+ );
+
+ $self->{_authorized_sections} = $options{authorized_sections};
+ $self->{_authorized_packages} = $options{authorized_packages}
+}
+
+sub run {
+ my ($self, $package, $repository, $target, $define) = @_;
+ croak "Not a class method" unless ref $self;
+
+ my $section = $repository->_get_section($package, $target, $define);
+ return 1 if $section =~ /$self->{_authorized_sections}/;
+ my $name = $package->get_name;
+ return 1 if $name =~ /$self->{_authorized_packages}/;
+ my @revisions = $repository->get_revisions($package, $target, $define, sub { $package->get_version ne $_[0]->get_version });
+ if (@revisions) {
+ $self->{_error} = "VERSION FREEZE, package @revisions of different versions exist in cooker\n";
+ return 0
+ }
+
+ return 1;
+}
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2006, YOURI project
+Copyright (C) 2006, Mandriva
+
+This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+=cut
+
+1;
+