diff options
author | Francois Pons <fpons@mandriva.com> | 2001-06-25 11:49:07 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2001-06-25 11:49:07 +0000 |
commit | ceb7065839c8a9cdbee85d628b1d39eeb7d69119 (patch) | |
tree | f6774c2ee96333cf6a318b8341b593757918892f | |
parent | 4cef6c365db4acae492aa687a24c7911ff9d650d (diff) | |
download | rpmtools-ceb7065839c8a9cdbee85d628b1d39eeb7d69119.tar rpmtools-ceb7065839c8a9cdbee85d628b1d39eeb7d69119.tar.gz rpmtools-ceb7065839c8a9cdbee85d628b1d39eeb7d69119.tar.bz2 rpmtools-ceb7065839c8a9cdbee85d628b1d39eeb7d69119.tar.xz rpmtools-ceb7065839c8a9cdbee85d628b1d39eeb7d69119.zip |
fix version compare for string like "0.beta4" compared to "0.rc1", the latest
should be the greatest on comparing "beta" and "rc".
-rw-r--r-- | rpmtools.pm | 2 |
1 files changed, 1 insertions, 1 deletions
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; |