r9011 - in /scripts/qa/DebianQA: Archive.pm DebVersions.pm Svn.pm Watch.pm
tincho-guest at users.alioth.debian.org
tincho-guest at users.alioth.debian.org
Thu Nov 8 08:01:29 UTC 2007
Author: tincho-guest
Date: Thu Nov 8 08:01:28 2007
New Revision: 9011
URL: http://svn.debian.org/wsvn/?sc=1&rev=9011
Log:
New deb_compare_nofail, to avoid deaths when sorting an invalid version.
Modified:
scripts/qa/DebianQA/Archive.pm
scripts/qa/DebianQA/DebVersions.pm
scripts/qa/DebianQA/Svn.pm
scripts/qa/DebianQA/Watch.pm
Modified: scripts/qa/DebianQA/Archive.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/Archive.pm?rev=9011&op=diff
==============================================================================
--- scripts/qa/DebianQA/Archive.pm (original)
+++ scripts/qa/DebianQA/Archive.pm Thu Nov 8 08:01:28 2007
@@ -93,7 +93,7 @@
}
foreach my $pkg (keys(%$g)) {
my @recent = sort( {
- deb_compare($g->{$pkg}{$a}, $g->{$pkg}{$b})
+ deb_compare_nofail($g->{$pkg}{$a}, $g->{$pkg}{$b})
} keys(%{$g->{$pkg}}));
$g->{$pkg}{most_recent} = $g->{$pkg}{$recent[-1]};
$g->{$pkg}{most_recent_src} = $recent[-1];
Modified: scripts/qa/DebianQA/DebVersions.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/DebVersions.pm?rev=9011&op=diff
==============================================================================
--- scripts/qa/DebianQA/DebVersions.pm (original)
+++ scripts/qa/DebianQA/DebVersions.pm Thu Nov 8 08:01:28 2007
@@ -13,7 +13,7 @@
use warnings;
our @ISA = "Exporter";
-our @EXPORT = qw( deb_compare );
+our @EXPORT = qw( deb_compare deb_compare_nofail );
sub deb_parse($) {
my $v = shift;
@@ -65,5 +65,17 @@
return deb_verrevcmp($va[2], $vb[2]);
}
+sub deb_compare_nofail($$) {
+ my @va = deb_parse($_[0]) or return 1;
+ my @vb = deb_parse($_[1]) or return -1;
+
+ # Epoch
+ return $va[0] <=> $vb[0] unless($va[0] == $vb[0]);
+
+ my $upstreamcmp = deb_verrevcmp($va[1], $vb[1]);
+ return $upstreamcmp unless(defined $upstreamcmp and $upstreamcmp == 0);
+
+ return deb_verrevcmp($va[2], $vb[2]);
+}
1;
Modified: scripts/qa/DebianQA/Svn.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/Svn.pm?rev=9011&op=diff
==============================================================================
--- scripts/qa/DebianQA/Svn.pm (original)
+++ scripts/qa/DebianQA/Svn.pm Thu Nov 8 08:01:28 2007
@@ -155,7 +155,7 @@
$svn{$dir}{watch_error} = "Invalid";
next;
}
- my @versions = sort({ deb_compare($a, $b) }
+ my @versions = sort({ deb_compare_nofail($a, $b) }
grep(defined, map({ $_->{unmangled_ver} } @$watch)));
$svn{$dir}{unmangled_ver} = $versions[-1];
$svn{$dir}{watch} = $watch;
Modified: scripts/qa/DebianQA/Watch.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/Watch.pm?rev=9011&op=diff
==============================================================================
--- scripts/qa/DebianQA/Watch.pm (original)
+++ scripts/qa/DebianQA/Watch.pm Thu Nov 8 08:01:28 2007
@@ -94,8 +94,8 @@
}
my @noerror = grep({ not $_->{watch_error} } @wresult);
@noerror = sort({
- deb_compare($a->{upstream_unmangled}, $b->{upstream_unmangled})
- } @noerror);
+ deb_compare_nofail($a->{upstream_unmangled},
+ $b->{upstream_unmangled}) } @noerror);
unless(@noerror) {
$watch2{$pkg} = { error => $wresult[0]{watch_error} };
next;
@@ -177,7 +177,8 @@
}
debug("Unmangled version: $mangled[-1]");
}
- my @order = sort({ deb_compare($mangled[$a], $mangled[$b]) } (0..$#vers));
+ my @order = sort({ deb_compare_nofail($mangled[$a], $mangled[$b]) }
+ (0..$#vers));
return(undef,
%{$vers[$order[-1]]},
upstream_unmangled => $mangled[$order[-1]]);
@@ -194,9 +195,8 @@
if(@rparts) {
my ($status, @data) = recurse_dirs($rparts[0], $base, "");
return $status unless(@data);
- @data = sort({
- deb_compare($a->{upstream_version}, $b->{upstream_version})
- } @data);
+ @data = sort({ deb_compare_nofail($a->{upstream_version},
+ $b->{upstream_version}) } @data);
$base = $data[-1]{upstream_url};
}
unless($base =~ m{(^\w+://[^/]+)(/.*?)/*$}) {
More information about the Pkg-perl-cvs-commits
mailing list