public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoolkit r629 - trunk/gentoolkit/pym/gentoolkit/glsa
@ 2009-05-07 22:01 Paul Varner (fuzzyray)
  0 siblings, 0 replies; only message in thread
From: Paul Varner (fuzzyray) @ 2009-05-07 22:01 UTC (permalink / raw
  To: gentoo-commits

Author: fuzzyray
Date: 2009-05-07 22:01:50 +0000 (Thu, 07 May 2009)
New Revision: 629

Modified:
   trunk/gentoolkit/pym/gentoolkit/glsa/__init__.py
Log:
Add patch from Robert Buchholz:

Backport SLOT support from Portage 2.2 glsa.py

In particular, this is a port of these commits:
commit 856616597ee791efa42dd59760db8e50e72efffd
Author: zmedico <zmedico@ac592a22-f3fe-0310-977e-98394eae9e84>
Date:   Wed Oct 8 22:35:31 2008 +0000

    Fix apparent breakage from r11593 (slot dep support):
    * Handle KeyError from element.getAttribute() in makeAtom() and
    * makeVersion().
    * Avoid 'sre_constants.error: unmatched group' exceptions in
    * revisionMatch()
      when the atom does not have a slot.



Modified: trunk/gentoolkit/pym/gentoolkit/glsa/__init__.py
===================================================================
--- trunk/gentoolkit/pym/gentoolkit/glsa/__init__.py	2009-05-07 21:59:54 UTC (rev 628)
+++ trunk/gentoolkit/pym/gentoolkit/glsa/__init__.py	2009-05-07 22:01:50 UTC (rev 629)
@@ -273,6 +273,13 @@
 	rValue = opMapping[versionNode.getAttribute("range")] \
 				+ pkgname \
 				+ "-" + getText(versionNode, format="strip")
+	try:
+		slot = versionNode.getAttribute("slot").strip()
+	except KeyError:
+		pass
+	else:
+		if slot and slot != "*":
+			rValue += ":" + slot
 	return str(rValue)
 
 def makeVersion(versionNode):
@@ -286,8 +293,16 @@
 	@rtype:		String
 	@return:	the version string
 	"""
-	return opMapping[versionNode.getAttribute("range")] \
+	rValue = opMapping[versionNode.getAttribute("range")] \
 			+getText(versionNode, format="strip")
+	try:
+		slot = versionNode.getAttribute("slot").strip()
+	except KeyError:
+		pass
+	else:
+		if slot and slot != "*":
+			rValue += ":" + slot
+	return rValue
 
 def match(atom, portdbname, match_type="default"):
 	"""
@@ -331,9 +346,15 @@
 	@return:	a list with the matching versions
 	"""
 	if match_type == "default" or not hasattr(portdb, "xmatch"):
-		mylist = portdb.match(re.sub("-r[0-9]+$", "", revisionAtom[2:]))
+		if ":" in revisionAtom:
+			mylist = portdb.match(re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:]))
+		else:
+			mylist = portdb.match(re.sub("-r[0-9]+$", "", revisionAtom[2:]))
 	else:
-		mylist = portdb.xmatch(match_type, re.sub("-r[0-9]+$", "", revisionAtom[2:]))
+		if ":" in revisionAtom:
+			mylist = portdb.xmatch(match_type, re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:]))
+		else:
+			mylist = portdb.xmatch(match_type, re.sub("-r[0-9]+$", "", revisionAtom[2:]))
 	rValue = []
 	for v in mylist:
 		r1 = portage.pkgsplit(v)[-1][1:]




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-07 22:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07 22:01 [gentoo-commits] gentoolkit r629 - trunk/gentoolkit/pym/gentoolkit/glsa Paul Varner (fuzzyray)

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