From ceb7065839c8a9cdbee85d628b1d39eeb7d69119 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Mon, 25 Jun 2001 11:49:07 +0000 Subject: fix version compare for string like "0.beta4" compared to "0.rc1", the latest should be the greatest on comparing "beta" and "rc". --- rpmtools.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpmtools.pm b/rpmtools.pm index 5b08d32..98b9895 100644 --- a/rpmtools.pm +++ b/rpmtools.pm @@ -582,7 +582,7 @@ sub version_compare { while ($a || $b) { my ($sb, $sa) = map { $1 if $a =~ /^\W*\d/ ? s/^\W*0*(\d+)// : s/^\W*(\D*)// } ($b, $a); - $_ = length($sa) <=> length($sb) || $sa cmp $sb and return $_ || 0; + $_ = ($sa =~ /^\d/ || $sb =~ /^\d/) && length($sa) <=> length($sb) || $sa cmp $sb and return $_ || 0; $sa eq '' && $sb eq '' and return $a cmp $b || 0; } 0; -- cgit v1.2.1