Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r9648 - main/trunk/pym/_emerge
Date: Mon, 31 Mar 2008 19:56:01
Message-Id: E1JgQ6o-00015L-6O@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-03-31 19:55:56 +0000 (Mon, 31 Mar 2008)
3 New Revision: 9648
4
5 Modified:
6 main/trunk/pym/_emerge/__init__.py
7 Log:
8 When selecting packages and there is a mixture of old-style and new-style
9 virtual matches, filter out the old-style virtual matches.
10
11
12 Modified: main/trunk/pym/_emerge/__init__.py
13 ===================================================================
14 --- main/trunk/pym/_emerge/__init__.py 2008-03-31 18:45:12 UTC (rev 9647)
15 +++ main/trunk/pym/_emerge/__init__.py 2008-03-31 19:55:56 UTC (rev 9648)
16 @@ -1190,7 +1190,7 @@
17 class Package(object):
18 __slots__ = ("__weakref__", "built", "cpv", "depth",
19 "installed", "metadata", "root", "onlydeps", "type_name",
20 - "cpv_slot", "slot_atom", "_digraph_node")
21 + "cp", "cpv_slot", "slot_atom", "_digraph_node")
22 def __init__(self, **kwargs):
23 for myattr in self.__slots__:
24 if myattr == "__weakref__":
25 @@ -1198,9 +1198,8 @@
26 myvalue = kwargs.get(myattr, None)
27 setattr(self, myattr, myvalue)
28
29 - self.slot_atom = "%s:%s" % \
30 - (portage.cpv_getkey(self.cpv), self.metadata["SLOT"])
31 -
32 + self.cp = portage.cpv_getkey(self.cpv)
33 + self.slot_atom = "%s:%s" % (self.cp, self.metadata["SLOT"])
34 self.cpv_slot = "%s:%s" % (self.cpv, self.metadata["SLOT"])
35
36 status = "merge"
37 @@ -2743,6 +2742,20 @@
38 for pkg in matched_packages:
39 print (pkg.type_name + ":").rjust(10), pkg.cpv
40
41 + # Filter out any old-style virtual matches if they are
42 + # mixed with new-style virtual matches.
43 + cp = portage.dep_getkey(atom)
44 + if len(matched_packages) > 1 and \
45 + "virtual" == portage.catsplit(cp)[0]:
46 + for pkg in matched_packages:
47 + if pkg.cp != cp:
48 + continue
49 + # Got a new-style virtual, so filter
50 + # out any old-style virtuals.
51 + matched_packages = [pkg for pkg in matched_packages \
52 + if pkg.cp == cp]
53 + break
54 +
55 if len(matched_packages) > 1:
56 bestmatch = portage.best(
57 [pkg.cpv for pkg in matched_packages])
58
59 --
60 gentoo-commits@l.g.o mailing list