Improve used of cached Package instances in depgraph._select_pkg_from_graph().
authorZac Medico <zmedico@gentoo.org>
Thu, 10 Apr 2008 06:09:08 +0000 (06:09 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 10 Apr 2008 06:09:08 +0000 (06:09 -0000)
(trunk r9787)

svn path=/main/branches/2.1.2/; revision=9791

bin/emerge

index 10912b245fcb34a48a83bdf71193d9e5932a99f3..406043ad2fd58318da75a8b2530b65df4d971eb2 100755 (executable)
@@ -1801,7 +1801,6 @@ class depgraph(object):
                self._select_atoms = self._select_atoms_highest_available
                self._select_package = self._select_pkg_highest_available
                self._highest_pkg_cache = {}
-               self._installed_pkg_cache = {}
 
        def _show_slot_collision_notice(self):
                """Show an informational message advising the user to mask one of the
@@ -2979,18 +2978,10 @@ class depgraph(object):
                e_pkg = self._slot_pkg_map[root].get(slot_atom)
                if e_pkg:
                        return e_pkg, e_pkg
-               cache_key = (root, atom, onlydeps)
-               ret = self._installed_pkg_cache.get(cache_key)
-               if ret is not None:
-                       return ret
-               metadata = dict(izip(self._mydbapi_keys,
-                       graph_db.aux_get(cpv, self._mydbapi_keys)))
-               pkg = Package(cpv=cpv, built=True,
-                       installed=True, type_name="installed",
-                       metadata=metadata, root=root)
-               ret = (pkg, None)
-               self._installed_pkg_cache[cache_key] = ret
-               return ret
+               # Since this cpv exists in the graph_db,
+               # we must have a cached Package instance.
+               cache_key = ("installed", root, cpv, "nomerge")
+               return (self._pkg_cache[cache_key], None)
 
        def _complete_graph(self):
                """