public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] ebuild version parse debugging
@ 2001-11-17 22:42 Donny Davies
  2001-11-18  7:44 ` Daniel Robbins
  2001-11-18 11:53 ` Martin Schlemmer
  0 siblings, 2 replies; 3+ messages in thread
From: Donny Davies @ 2001-11-17 22:42 UTC (permalink / raw
  To: gentoo-dev

Hi, devs

Using portage-1.7.2, and an empty /etc/make.profile/packages
file (just to eliminate that stuff from the equation), out of these 3
choices:

openssh-3.1.ebuild
openssh-3.1_beta.ebuild
openssh-3.1_pre5.ebuild

portage is choosing openssh-3.1_pre5.ebuild

<scratch>  Sorry Im not sure what the fix is, although Im sure it
touches portage.pym somewhere?  Oh the openssh ebuilds are
just phantoms, its not actually released yet ;)

Regards
--
Donny




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] ebuild version parse debugging
  2001-11-17 22:42 [gentoo-dev] ebuild version parse debugging Donny Davies
@ 2001-11-18  7:44 ` Daniel Robbins
  2001-11-18 11:53 ` Martin Schlemmer
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Robbins @ 2001-11-18  7:44 UTC (permalink / raw
  To: gentoo-dev

On Sat, Nov 17, 2001 at 05:42:06PM -0500, Donny Davies wrote:
> Hi, devs
> 
> Using portage-1.7.2, and an empty /etc/make.profile/packages
> file (just to eliminate that stuff from the equation), out of these 3
> choices:
> 
> openssh-3.1.ebuild
> openssh-3.1_beta.ebuild
> openssh-3.1_pre5.ebuild
> 
> portage is choosing openssh-3.1_pre5.ebuild

I've verified this over here too, and I know where the code is flaking out.
To fix it, I may roll in some Portagev2 "eid" code to replace our current
very old and very slow code.  Since this isn't a biggie (_pre is rarely used),
we'll probably go in this direction.  Should be a fun day project.

Best Regards,

-- 
Daniel Robbins                                  <drobbins@gentoo.org>
Chief Architect/President                       http://www.gentoo.org 
Gentoo Technologies, Inc.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] ebuild version parse debugging
  2001-11-17 22:42 [gentoo-dev] ebuild version parse debugging Donny Davies
  2001-11-18  7:44 ` Daniel Robbins
@ 2001-11-18 11:53 ` Martin Schlemmer
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Schlemmer @ 2001-11-18 11:53 UTC (permalink / raw
  To: Gentoo-Dev


[-- Attachment #1.1: Type: text/plain, Size: 873 bytes --]

On Sun, 2001-11-18 at 00:42, Donny Davies wrote:
> Hi, devs
> 
> Using portage-1.7.2, and an empty /etc/make.profile/packages
> file (just to eliminate that stuff from the equation), out of these 3
> choices:
> 
> openssh-3.1.ebuild
> openssh-3.1_beta.ebuild
> openssh-3.1_pre5.ebuild
> 
> portage is choosing openssh-3.1_pre5.ebuild
> 

Hi

Did some scratching of my own, and it seems that the python
function .keys() do not parse things in the correct order.
Where "pre" should be checked before "p" (drobbins and other
portage hackers should know what im talking about) according
to the order in 'endversion', .keys() actually cause "p"
to be checked first, which causes this problem.

Attached is a patch that should fix this.


Greetings,

-- 

Martin Schlemmer
Gentoo Linux Developer, Desktop Team Developer
Cape Town, South Africa


[-- Attachment #1.2: portage.py.diff --]
[-- Type: text/plain, Size: 2072 bytes --]

--- portage.py.orig	Sun Nov 18 13:36:52 2001
+++ portage.py	Sun Nov 18 13:43:33 2001
@@ -226,6 +226,8 @@
 # valid end of version components; integers specify offset from release version
 # pre=prerelease, p=patchlevel (should always be followed by an int), rc=release candidate
 # all but _p (where it is required) can be followed by an optional trailing integer
+#
+# NOTE: remember to update myendversion in relparse() if you update this
 
 endversion={"pre":-2,"p":0,"alpha":-4,"beta":-3,"rc":-1}
 
@@ -766,6 +768,12 @@
 
 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={"pre":-2,"alpha":-4,"beta":-3,"rc":-1}
 	number=0
 	p1=0
 	p2=0
@@ -774,25 +782,36 @@
 		#an endversion
 		number=string.atof(mynewver[0])
 		match=0
-		for x in endversion.keys():
+		for x in myendversion.keys():
 			elen=len(x)
 			if mynewver[1][:elen] == x:
 				match=1
-				p1=endversion[x]
+				p1=myendversion[x]
 				try:
 					p2=string.atof(mynewver[1][elen:])
 				except:
 					p2=0
 				break
-		if not match:	
-			#normal number or number with letter at end
-			divider=len(myver)-1
-			if myver[divider:] not in "1234567890":
-				#letter at end
-				p1=ord(myver[divider:])
-				number=string.atof(myver[0:divider])
-			else:
-				number=string.atof(myver)		
+		if not match:
+			#look for _p?
+			matchp=0
+			elen=1
+			if mynewver[1][:elen] == "p":
+				matchp=1
+				p1=0
+				try:
+					p2=string.atof(mynewver[1][elen:])
+				except:
+					p2=0
+			if not matchp:
+				#normal number or number with letter at end
+				divider=len(myver)-1
+				if myver[divider:] not in "1234567890":
+					#letter at end
+					p1=ord(myver[divider:])
+					number=string.atof(myver[0:divider])
+				else:
+					number=string.atof(myver)	
 	else:
 		#normal number or number with letter at end
 		divider=len(myver)-1

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-11-18 11:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-17 22:42 [gentoo-dev] ebuild version parse debugging Donny Davies
2001-11-18  7:44 ` Daniel Robbins
2001-11-18 11:53 ` Martin Schlemmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox