Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Sep 2000 00:24:01 +0200
From:      Neil Blakey-Milner <nbm@mithrandr.moria.org>
To:        Akinori -Aki- MUSHA <knu@idaemons.org>
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>
In-Reply-To: <86k8by6eis.wl@archon.local.idaemons.org>; from knu@idaemons.org on Wed, Sep 27, 2000 at 06:15:39AM %2B0900
References:  <86k8by6eis.wl@archon.local.idaemons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000927002401.A73341>