From 5070f3f86e1897c43fb47007d9aebd55c68f5c9e Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 25 Jul 2001 14:59:35 +0000 Subject: use rpmlib version comparison function, force destiny. --- rpmtools.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'rpmtools.pm') diff --git a/rpmtools.pm b/rpmtools.pm index ab7e7d8..5c8445d 100644 --- a/rpmtools.pm +++ b/rpmtools.pm @@ -601,16 +601,18 @@ sub compat_arch { better_arch(arch(), $_[0]) } #- compare a version string, make sure no deadlock can occur. #- try to return always a numerical value. sub version_compare { - my ($a, $b) = @_; - local $_; - - while ($a || $b) { - my ($sb, $sa) = map { $1 if $a =~ /^\W*\d/ ? s/^\W*0*(\d+)// : s/^\W*(\D*)// } ($b, $a); - $_ = ($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; + return rpmvercmp(@_); } +#- historical perl version (still breaks on "4m" with "4.1m"... +#- my ($a, $b) = @_; +#- local $_; +#- +#- while ($a || $b) { +#- my ($sb, $sa) = map { $1 if $a =~ /^\W*\d/ ? s/^\W*0*(\d+)// : s/^\W*(\D*)// } ($b, $a); +#- $_ = ($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; #- compare package name to increase chance of avoiding loop in prerequisite chain. sub package_name_compare { -- cgit v1.2.1