aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@FreeBSD.org>2001-04-19 23:53:46 +0000
committerBruce A. Mah <bmah@FreeBSD.org>2001-04-19 23:53:46 +0000
commitd8859683939151f394e5233be9e054621b7aca33 (patch)
treeb192623a0bc4814a592d782b122555935f5b7248
parent5261a13b7f8e660ea47922b879c5af8d32471e6c (diff)
downloadsrc-d8859683939151f394e5233be9e054621b7aca33.tar.gz
src-d8859683939151f394e5233be9e054621b7aca33.zip
MFC: Fix problem with tests of the form "1.0" vs. "1.0a".
pkg_version.pl 1.17->1.18 test-pkg_version.sh 1.1->1.2 Approved by: jkh
Notes
Notes: svn path=/stable/4/; revision=75720
-rwxr-xr-xusr.sbin/pkg_install/version/pkg_version.pl13
-rwxr-xr-xusr.sbin/pkg_install/version/test-pkg_version.sh5
2 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/version/pkg_version.pl b/usr.sbin/pkg_install/version/pkg_version.pl
index 8b48090acc1f..7118fab98e73 100755
--- a/usr.sbin/pkg_install/version/pkg_version.pl
+++ b/usr.sbin/pkg_install/version/pkg_version.pl
@@ -148,7 +148,18 @@ sub CompareNumbers {
else {
$c1 =~ s/\d+//;
$c2 =~ s/\d+//;
- return &CompareNumbers($c1, $c2);
+ if ($c1 eq $c2) {
+ return 0;
+ }
+ elsif ($c1 eq "") {
+ return -1;
+ }
+ elsif ($c2 eq "") {
+ return 1;
+ }
+ else {
+ return &CompareNumbers($c1, $c2);
+ }
}
}
}
diff --git a/usr.sbin/pkg_install/version/test-pkg_version.sh b/usr.sbin/pkg_install/version/test-pkg_version.sh
index 6c14c71f8432..3cfaea15cb13 100755
--- a/usr.sbin/pkg_install/version/test-pkg_version.sh
+++ b/usr.sbin/pkg_install/version/test-pkg_version.sh
@@ -61,8 +61,9 @@ test-pv 0.9 "<" 0.10 inequality
test-pv 2.3p10 ">" 2.3p9 number/letter
test-pv 1.6.0 ">" 1.6.0.p3 number/letter
test-pv 1.0.b ">" 1.0.a3 number/letter
-test-pv 1.0a "<" 1.0 number/letter
-test-pv 5.0a "<" 5.0.b number/letter
+test-pv 1.0a ">" 1.0 number/letter
+test-pv 1.0a "<" 1.0b number/letter
+test-pv 5.0a ">" 5.0.b number/letter
test-pv 1.5_1 ">" 1.5 portrevision
test-pv 1.5_2 ">" 1.5_1 portrevision