Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r12494 - main/trunk/pym/_emerge
Date: Tue, 13 Jan 2009 04:43:44
Message-Id: E1LMb7t-0007HS-UR@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-01-13 04:43:40 +0000 (Tue, 13 Jan 2009)
3 New Revision: 12494
4
5 Modified:
6 main/trunk/pym/_emerge/__init__.py
7 Log:
8 Simplify depgraph._select_pkg_from_graph() by using match_pkgs().
9
10
11 Modified: main/trunk/pym/_emerge/__init__.py
12 ===================================================================
13 --- main/trunk/pym/_emerge/__init__.py 2009-01-12 19:57:26 UTC (rev 12493)
14 +++ main/trunk/pym/_emerge/__init__.py 2009-01-13 04:43:40 UTC (rev 12494)
15 @@ -6234,19 +6234,12 @@
16 replacement.
17 """
18 graph_db = self._graph_trees[root]["porttree"].dbapi
19 - matches = graph_db.match(atom)
20 + matches = graph_db.match_pkgs(atom)
21 if not matches:
22 return None, None
23 - cpv = matches[-1] # highest match
24 - slot_atom = "%s:%s" % (portage.cpv_getkey(cpv),
25 - graph_db.aux_get(cpv, ["SLOT"])[0])
26 - e_pkg = self._slot_pkg_map[root].get(slot_atom)
27 - if e_pkg:
28 - return e_pkg, e_pkg
29 - # Since this cpv exists in the graph_db,
30 - # we must have a cached Package instance.
31 - cache_key = ("installed", root, cpv, "nomerge")
32 - return (self._pkg_cache[cache_key], None)
33 + pkg = matches[-1] # highest match
34 + in_graph = self._slot_pkg_map[root].get(pkg.slot_atom)
35 + return pkg, in_graph
36
37 def _complete_graph(self):
38 """