diff options
author | eik <eik@FreeBSD.org> | 2004-06-29 18:52:13 +0000 |
---|---|---|
committer | eik <eik@FreeBSD.org> | 2004-06-29 18:52:13 +0000 |
commit | 649576111eab9cebc8bcde1eb574a9f3644fe2a6 (patch) | |
tree | 10ac754f350847c507ac2ca7492fe82ce7cabdf4 /usr.sbin/pkg_install/version | |
parent | 486f03d1c3d52e46694e570a1fe6a5336a36718c (diff) | |
download | FreeBSD-src-649576111eab9cebc8bcde1eb574a9f3644fe2a6.zip FreeBSD-src-649576111eab9cebc8bcde1eb574a9f3644fe2a6.tar.gz |
- complete rewrite of the version number parsing code, restoring compatibiliy of 5.x with 4.x and portupgrade
- parse version numbers of ports containing an underscore followed by a number correctly
- handle special strings pl, alpha, beta, pre and rc
PR: 56961
Diffstat (limited to 'usr.sbin/pkg_install/version')
-rw-r--r-- | usr.sbin/pkg_install/version/perform.c | 9 | ||||
-rwxr-xr-x | usr.sbin/pkg_install/version/test-pkg_version.sh | 19 |
2 files changed, 25 insertions, 3 deletions
diff --git a/usr.sbin/pkg_install/version/perform.c b/usr.sbin/pkg_install/version/perform.c index 6c345b9..8643dd2 100644 --- a/usr.sbin/pkg_install/version/perform.c +++ b/usr.sbin/pkg_install/version/perform.c @@ -271,10 +271,12 @@ show_version(const char *installed, const char *latest, const char *source) ch = strchr(tmp, '|'); ch[0] = '\0'; - ver = version_of(tmp, NULL, NULL); + ver = strrchr(tmp, '-'); + ver = ver ? &ver[1] : tmp; printf(" multiple versions (index has %s", ver); do { - ver = version_of(&ch[1], NULL, NULL); + ver = strrchr(&ch[1], '-'); + ver = ver ? &ver[1] : &ch[1]; if ((ch = strchr(&ch[1], '|')) != NULL) ch[0] = '\0'; printf(", %s", ver); @@ -285,7 +287,8 @@ show_version(const char *installed, const char *latest, const char *source) } } else { cmp = version_cmp(installed, latest); - ver = version_of(latest, NULL, NULL); + ver = strrchr(latest, '-'); + ver = ver ? &ver[1] : latest; if (cmp < 0 && OUTPUT('<')) { printf("%-34s <", tmp); if (Verbose) diff --git a/usr.sbin/pkg_install/version/test-pkg_version.sh b/usr.sbin/pkg_install/version/test-pkg_version.sh index 0651047..5c3d98d 100755 --- a/usr.sbin/pkg_install/version/test-pkg_version.sh +++ b/usr.sbin/pkg_install/version/test-pkg_version.sh @@ -73,3 +73,22 @@ test-pv 1.5 "<" 1.5.0.1 portrevision test-pv 00.01.01,1 ">" 99.12.31 portepoch test-pv 0.0.1_1,2 ">" 0.0.1,2 portrevision/portepoch test-pv 0.0.1_1,3 ">" 0.0.1_2,2 portrevision/portepoch + +test-pv 2.0 ">" 2.a2 number/letter +test-pv 3 "=" 3.0 equality +test-pv 4a "<" 4a0 letter/zero +test-pv 10a1b2 "=" 10a1.b2 separator + +test-pv 7pl "=" 7.pl patchevel +test-pv 8.0.a "=" 8.0alpha alpha +test-pv 9.b3.0 "=" 9beta3 beta +test-pv 10.pre7 "=" 10pre7.0 pre +test-pv 11.r "=" 11.rc rc + +test-pv 12pl "<" 12alpha alpha/patchevel +test-pv 13.* "<" 13.pl star/patchevel + +test-pv 1.0.0+2003.09.06 "=" 1.0+2003.09.06 plus/multiple +test-pv 1.0.1+2003.09.06 ">" 1.0+2003.09.06 plus/multiple +test-pv 1.0.0+2003.09.06 "<" 1.0+2003.09.06_1 plus/portrevision +test-pv 1.0.1+2003.09.06 ">" 1.0+2003.09.06_1 plus/portrevision |