From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on finch.gentoo.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DMARC_NONE,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=4.0.0 Received: from mono.mweb.co.za (mono.mweb.co.za [196.2.53.170]) by chiba.3jane.net (Postfix) with ESMTP id 6DA711A7B8 for ; Sun, 16 Dec 2001 05:21:24 -0600 (CST) Received: from [196.30.178.141] (helo=nosferatu.lan) by mono.mweb.co.za with esmtp (Exim 3.33 #2) id 16FZFc-0001b7-00 for gentoo-dev@gentoo.org; Sun, 16 Dec 2001 13:14:36 +0200 Subject: Re: [gentoo-dev] Possible portage 1.7.7 bug?? From: Martin Schlemmer To: Gentoo-Dev In-Reply-To: <20011215015245.A55484@enteract.com> References: <20011215015245.A55484@enteract.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-pI7x+WKfryUQq8pHEcua" X-Mailer: Evolution/1.0 (Preview Release) Date: 16 Dec 2001 13:19:47 +0200 Message-Id: <1008501591.28704.7.camel@nosferatu.lan> Mime-Version: 1.0 Sender: gentoo-dev-admin@gentoo.org Errors-To: gentoo-dev-admin@gentoo.org X-BeenThere: gentoo-dev@gentoo.org X-Mailman-Version: 2.0.6 Precedence: bulk Reply-To: gentoo-dev@gentoo.org List-Help: List-Post: List-Subscribe: , List-Id: Developer discussion list List-Unsubscribe: , List-Archive: X-Archives-Salt: ccf90779-e9f0-4806-a397-ba33fb5e809c X-Archives-Hash: 4ad94ab8eaa88af640f0be8136a663d8 --=-pI7x+WKfryUQq8pHEcua Content-Type: multipart/mixed; boundary="=-rn+hvkRTd2nkxLGSwJIX" --=-rn+hvkRTd2nkxLGSwJIX Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sat, 2001-12-15 at 09:52, Terry Chan wrote: > Hi, >=20 > When using portage 1.7.7 try this to test for a possible bug > in deciding latest versions of package names again: >=20 > emerge net-misc/openssh >=20 > Portage chooses openssh-3.0_p1-r6, but there are at least two other > ebuilds that are greater than this, namely openssh-3.0.1_p1 and > openssh-3.0.2_p1 >=20 > openssh is not in package.mask, so I don't think that is part of this > problem. >=20 > Is this a real bug? Am I interpreting the ebuild names incorrectly? >=20 Hi It is a small bug in portage (been there some time now), but since portage2 is in the works, Daniel decided not to hack broken code with even uglier hacks. The openssh thing we fixed with removing the old ebuilds (emerge --clean rsync sould update it). Otherwise you could try this *cough* unsupported *cough* patch which I made some time ago. Please note that portage2 will fix this, and with cool regexp will be much faster and saner. Greetings, --=20 Martin Schlemmer Gentoo Linux Developer, Desktop Team Developer Cape Town, South Africa --=-rn+hvkRTd2nkxLGSwJIX Content-Disposition: attachment; filename=portage-ebuild-version.patch Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable --- portage.py.orig Sun Nov 18 13:36:52 2001 +++ portage.py Mon Nov 19 21:45:05 2001 @@ -226,6 +226,8 @@ # valid end of version components; integers specify offset from release ve= rsion # pre=3Dprerelease, p=3Dpatchlevel (should always be followed by an int), = rc=3Drelease candidate # all but _p (where it is required) can be followed by an optional trailin= g integer +# +# NOTE: remember to update myendversion in relparse() if you update this =20 endversion=3D{"pre":-2,"p":0,"alpha":-4,"beta":-3,"rc":-1} =20 @@ -766,6 +768,12 @@ =20 def relparse(myver): "converts last version part into three components" + + # the .keys() function parses "p" before "pre", so check without "p" + # first, then check for "p" afterwards + # + # NOTE: do NOT add "p" to myendversion! + myendversion=3D{"pre":-2,"alpha":-4,"beta":-3,"rc":-1} number=3D0 p1=3D0 p2=3D0 @@ -774,25 +782,36 @@ #an endversion number=3Dstring.atof(mynewver[0]) match=3D0 - for x in endversion.keys(): + for x in myendversion.keys(): elen=3Dlen(x) if mynewver[1][:elen] =3D=3D x: match=3D1 - p1=3Dendversion[x] + p1=3Dmyendversion[x] try: p2=3Dstring.atof(mynewver[1][elen:]) except: p2=3D0 break - if not match:=09 - #normal number or number with letter at end - divider=3Dlen(myver)-1 - if myver[divider:] not in "1234567890": - #letter at end - p1=3Dord(myver[divider:]) - number=3Dstring.atof(myver[0:divider]) - else: - number=3Dstring.atof(myver) =09 + if not match: + #look for _p? + matchp=3D0 + elen=3D1 + if mynewver[1][:elen] =3D=3D "p": + matchp=3D1 + p1=3D0 + try: + p2=3Dstring.atof(mynewver[1][elen:]) + except: + p2=3D0 + if not matchp: + #normal number or number with letter at end + divider=3Dlen(myver)-1 + if myver[divider:] not in "1234567890": + #letter at end + p1=3Dord(myver[divider:]) + number=3Dstring.atof(myver[0:divider]) + else: + number=3Dstring.atof(myver)=09 else: #normal number or number with letter at end divider=3Dlen(myver)-1 @@ -978,12 +997,55 @@ val2=3Dstring.split(val2[0],'.') for x in val2[1:]: x=3D"."+x + + changed1=3D0 + changed2=3D0 + + # the '_' should be in the same 'digit', else comparing + # digit for diget fails and returns the wrong version as + # being the latest + if not len(val1)=3D=3Dlen(val2): + if len(val1)