From owner-freebsd-ports Tue Sep 26 15:24:25 2000 Delivered-To: freebsd-ports@freebsd.org Received: from ns1.sunesi.net (ns1.sunesi.net [196.15.192.194]) by hub.freebsd.org (Postfix) with ESMTP id 6A99537B424; Tue, 26 Sep 2000 15:24:14 -0700 (PDT) Received: from nbm by ns1.sunesi.net with local (Exim 3.03 #1) id 13e38r-000J7J-00; Wed, 27 Sep 2000 00:24:01 +0200 Date: Wed, 27 Sep 2000 00:24:01 +0200 From: Neil Blakey-Milner To: Akinori -Aki- MUSHA Cc: freebsd-ports@FreeBSD.org, bmah@FreeBSD.org Subject: Re: Enhancement of pkg_version's version comparison routine Message-ID: <20000927002401.A73341@mithrandr.moria.org> References: <86k8by6eis.wl@archon.local.idaemons.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <86k8by6eis.wl@archon.local.idaemons.org>; from knu@idaemons.org on Wed, Sep 27, 2000 at 06:15:39AM +0900 Organization: Sunesi Clinical Systems X-Operating-System: FreeBSD 3.3-RELEASE i386 X-URL: http://rucus.ru.ac.za/~nbm/ Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Wed 2000-09-27 (06:15), Akinori -Aki- MUSHA wrote: > I made a patch that fixes pkg_version's version comparison routine. > In short, it makes pkg_version recognize alpha ("a"), beta ("b"), > pre ("p"), and patchlevels as the handbook says. > > With this fix, comparisons will result as the following: > > Winer Loser Comment > 1.6.0 1.6.0.p3 Pre is before the release (*) > 1.0.b 1.0.a3 Beta is after alpha's > 1.0a 1.0 A letter "a" means alpha only when it appears > after an period. > 5.0a 5.0.b Ditto. > 3.2.ab1 3.2.p1 "ab" is unknown, but at least it should be > after alpha's, beta's and pre's. (*) > 2.3pl10 2.3pl9 Patchlevel 10 is after 9, of course (*) > > where (*) indicates previously it wasn't handled correctly. You rule. If you or anyone else is bored, hack multi-version support into pkg_version like I did way-back-when: webalizer-1.30.4 = up-to-date webalizer-2.00.12 = up-to-date Is much better than: webalizer-1.30.4,2.00.12 ? multiple versions (index has 1.30.4,2.00.12) And: mod_php-4.0.1.2 ? multiple versions (index has 3.0.16,4.0.2) Isn't as helpful as: mod_php-4.0.1.2 < needs updating (index has 4.0.2) The idea is to take each installed version of a port, and compare it to the versions available in the INDEX, using a simplistic string-compare or similar arrangement. mod_php has installed version 4.0.1.2, and available versions 3.0.16 and 4.0.2. For the first number, the installed version has '4', and the first version has '3', and the second version has '4', so the second version wins. So, if we have 4.0.1.2 installed, and 4.0.1.3 and 4.0.2.2 available, it's the same until '4.0.'. Then, '1' in installed compares to '1' in first available, and '2' in second available, so first available wins. I short-cutted with direct value checks, so 4.0.1.2 installed and 4.0.1.2 and 4.0.2.2 available jumped immediately to 4.0.1.2, and said 'out-of-date'. Previous code at: http://rucus.ru.ac.za/~nbm/pkg_version/ (about 10 months (7 Dev 1999) old) Neil -- Neil Blakey-Milner Sunesi Clinical Systems nbm@mithrandr.moria.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message