diff options
author | Florent Villard <warly@mandriva.com> | 2006-08-04 16:45:06 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2006-08-04 16:45:06 +0000 |
commit | 0a7ef4aa1b338a6c23dccd0db15086596f05a22a (patch) | |
tree | 620105c88261aa086535f04d1ca5fba94cb4cbbf /lib/Youri/Upload/Check/Precedence.pm | |
parent | 1fec4f0cac5732229070c4ad2e24c01ba2bab51b (diff) | |
download | mga-youri-core-0a7ef4aa1b338a6c23dccd0db15086596f05a22a.tar mga-youri-core-0a7ef4aa1b338a6c23dccd0db15086596f05a22a.tar.gz mga-youri-core-0a7ef4aa1b338a6c23dccd0db15086596f05a22a.tar.bz2 mga-youri-core-0a7ef4aa1b338a6c23dccd0db15086596f05a22a.tar.xz mga-youri-core-0a7ef4aa1b338a6c23dccd0db15086596f05a22a.zip |
imported initial version of youri svn
Diffstat (limited to 'lib/Youri/Upload/Check/Precedence.pm')
-rw-r--r-- | lib/Youri/Upload/Check/Precedence.pm | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/lib/Youri/Upload/Check/Precedence.pm b/lib/Youri/Upload/Check/Precedence.pm new file mode 100644 index 0000000..b03c2ad --- /dev/null +++ b/lib/Youri/Upload/Check/Precedence.pm @@ -0,0 +1,54 @@ +# $Id: Precedence.pm 873 2006-04-15 17:04:27Z guillomovitch $ +package Youri::Upload::Check::Precedence; + +=head1 NAME + +Youri::Upload::Check::Precedence - Release check against another check + +=head1 DESCRIPTION + +This check plugin rejects packages whose an older revision already exists for +another upload target. + +=cut + +use warnings; +use strict; +use Carp; +use base qw/Youri::Upload::Check/; + +sub _init { + my $self = shift; + my %options = ( + _target => undef, # mandatory targets + @_ + ); + + die "undefined target" unless $options{target}; + + $self->{_target} = $options{target}; +} + +sub run { + my ($self, $package, $repository, $target, $define) = @_; + croak "Not a class method" unless ref $self; + + my @older_revisions = + $repository->get_older_revisions($package, $self->{_target}, $define); + if (@older_revisions) { + $self->{_error} = "Older revisions still exists for $self->{_target}: " . join(', ', @older_revisions); + return 0; + } + + return 1; +} + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2002-2006, YOURI project + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=cut + +1; |