From 7a9816909da6ea69827b81524bb904f1524258ff Mon Sep 17 00:00:00 2001 From: Gustavo De Nardin Date: Sat, 23 Jun 2007 08:10:53 +0000 Subject: - check for newer and same existing revisions in a single pass - use proper get_revisions() instead of get_install_file() hack, as the latter will use the current file name, and thus will fail to check for an existing package revision when submitting, because submitted SRPMs have a different name ("@rev:foobar-...") than what goes into the repository --- lib/Youri/Submit/Check/Recency.pm | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/Youri/Submit/Check/Recency.pm b/lib/Youri/Submit/Check/Recency.pm index 40e34e8..f8aa5b7 100644 --- a/lib/Youri/Submit/Check/Recency.pm +++ b/lib/Youri/Submit/Check/Recency.pm @@ -23,21 +23,12 @@ sub run { my @errors; - my $file = $repository->get_install_file($package, $target, $define); - if (-f $file) { + my @revisions = $repository->get_revisions($package, $target, $define, undef, sub { return $_[0]->compare($package) >= 0 }); + if (@revisions) { push( @errors, - "Current revision already exists for $target" - ); - } - - my @newer_revisions = - $repository->get_newer_revisions($package, $target, $define); - if (@newer_revisions) { - push( - @errors, - "Newer revisions already exists for $target: " . - join(', ', @newer_revisions) + "Current or newer revision(s) already exists for $target: " . + join(', ', @revisions) ); } -- cgit v1.2.1