public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Possible portage 1.7.7 bug??
@ 2001-12-15  7:52 Terry Chan
  2001-12-16 11:19 ` Martin Schlemmer
  0 siblings, 1 reply; 2+ messages in thread
From: Terry Chan @ 2001-12-15  7:52 UTC (permalink / raw
  To: gentoo-dev

Hi,

When using portage 1.7.7 try this to test for a possible bug
in deciding latest versions of package names again:

emerge net-misc/openssh

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

openssh is not in package.mask, so I don't think that is part of this
problem.

Is this a real bug?  Am I interpreting the ebuild names incorrectly?

Terry Chan


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

* Re: [gentoo-dev] Possible portage 1.7.7 bug??
  2001-12-15  7:52 [gentoo-dev] Possible portage 1.7.7 bug?? Terry Chan
@ 2001-12-16 11:19 ` Martin Schlemmer
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Schlemmer @ 2001-12-16 11:19 UTC (permalink / raw
  To: Gentoo-Dev


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

On Sat, 2001-12-15 at 09:52, Terry Chan wrote:
> Hi,
> 
> When using portage 1.7.7 try this to test for a possible bug
> in deciding latest versions of package names again:
> 
> emerge net-misc/openssh
> 
> 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
> 
> openssh is not in package.mask, so I don't think that is part of this
> problem.
> 
> Is this a real bug?  Am I interpreting the ebuild names incorrectly?
> 

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,
-- 

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


[-- Attachment #1.2: portage-ebuild-version.patch --]
[-- Type: text/plain, Size: 3603 bytes --]

--- 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 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
@@ -978,12 +997,55 @@
 	val2=string.split(val2[0],'.')
 	for x in val2[1:]:
 		x="."+x
+
+	changed1=0
+	changed2=0
+
+	# 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)==len(val2):
+		if len(val1)<len(val2):
+			myrange=len(val1)
+		else:
+			myrange=len(val2)
+		for x in range(myrange):
+				mynewval=string.split(val1[x],"_")
+				if len(mynewval)==2:
+					changed1=1
+					val1[x]="."+mynewval[0]+".0_"+mynewval[1]
+				
+				mynewval=string.split(val2[x],"_")
+				if len(mynewval)==2:
+					changed2=1
+					val2[x]="."+mynewval[0]+".0_"+mynewval[1]
+	
+	# the previous function split each 'digit', so add these
+	# to the main version string (sorda, dont know how to explain)
+	if changed1==1:
+		val1=string.join(val1)
+		val1=string.split(val1,'.')
+		for x in val1[1:]:
+			x="."+x
+	if changed2==1:
+		val2=string.join(val2)
+		val2=string.split(val2,'.')
+		for x in val2[1:]:
+			x="."+x
+
 	if len(val2)<len(val1):
 		for x in range(0,len(val1)-len(val2)):
 			val2.append("0")
 	elif len(val1)<len(val2):
 		for x in range(0,len(val2)-len(val1)):
 			val1.append("0")
+
+	# somewhere spaces gets added, so remove these
+	for x in range(0,len(val1)):
+		val1[x]=string.strip(val1[x])
+	for x in range(0,len(val2)):
+		val2[x]=string.strip(val2[x])
+
 	#The above code will extend version numbers out so they
 	#have the same number of digits.
 	myval1=[]

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

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

end of thread, other threads:[~2001-12-16 11:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-15  7:52 [gentoo-dev] Possible portage 1.7.7 bug?? Terry Chan
2001-12-16 11:19 ` Martin Schlemmer

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