Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r11659 - main/trunk/pym/portage
Date: Wed, 08 Oct 2008 22:35:49
Message-Id: E1Knhcy-0007nF-Bg@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-10-08 22:35:31 +0000 (Wed, 08 Oct 2008)
3 New Revision: 11659
4
5 Modified:
6 main/trunk/pym/portage/glsa.py
7 Log:
8 Fix apparent breakage from r11593 (slot dep support):
9 * Handle KeyError from element.getAttribute() in makeAtom() and makeVersion().
10 * Avoid 'sre_constants.error: unmatched group' exceptions in revisionMatch()
11 when the atom does not have a slot.
12
13
14 Modified: main/trunk/pym/portage/glsa.py
15 ===================================================================
16 --- main/trunk/pym/portage/glsa.py 2008-10-08 18:25:39 UTC (rev 11658)
17 +++ main/trunk/pym/portage/glsa.py 2008-10-08 22:35:31 UTC (rev 11659)
18 @@ -226,8 +226,13 @@
19 rValue = opMapping[versionNode.getAttribute("range")] \
20 + pkgname \
21 + "-" + getText(versionNode, format="strip")
22 - if "slot" in versionNode.attributes and versionNode.getAttribute("slot") != "*":
23 - rValue += ":"+versionNode.getAttribute("slot")
24 + try:
25 + slot = versionNode.getAttribute("slot").strip()
26 + except KeyError:
27 + pass
28 + else:
29 + if slot and slot != "*":
30 + rValue += ":" + slot
31 return str(rValue)
32
33 def makeVersion(versionNode):
34 @@ -243,8 +248,13 @@
35 """
36 rValue = opMapping[versionNode.getAttribute("range")] \
37 + getText(versionNode, format="strip")
38 - if "slot" in versionNode.attributes and versionNode.getAttribute("slot") != "*":
39 - rValue += ":"+versionNode.getAttribute("slot")
40 + try:
41 + slot = versionNode.getAttribute("slot").strip()
42 + except KeyError:
43 + pass
44 + else:
45 + if slot and slot != "*":
46 + rValue += ":" + slot
47 return rValue
48
49 def match(atom, dbapi, match_type="default"):
50 @@ -288,9 +298,15 @@
51 @return: a list with the matching versions
52 """
53 if match_type == "default" or not hasattr(dbapi, "xmatch"):
54 - mylist = dbapi.match(re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:]))
55 + if ":" in revisionAtom:
56 + mylist = dbapi.match(re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:]))
57 + else:
58 + mylist = dbapi.match(re.sub("-r[0-9]+$", "", revisionAtom[2:]))
59 else:
60 - mylist = dbapi.xmatch(match_type, re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:]))
61 + if ":" in revisionAtom:
62 + mylist = dbapi.xmatch(match_type, re.sub(r'-r[0-9]+(:[^ ]+)?$', r'\1', revisionAtom[2:]))
63 + else:
64 + mylist = dbapi.xmatch(match_type, re.sub("-r[0-9]+$", "", revisionAtom[2:]))
65 rValue = []
66 for v in mylist:
67 r1 = pkgsplit(v)[-1][1:]