summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-09-21 20:39:39 +0200
committerZac Medico <zmedico@gentoo.org>2010-09-26 23:50:14 -0700
commitb484ce5218c988151416065ad86af2599838b77f (patch)
tree734d001a3bfed15f3b3b46d49a498cd5e24cfe2d
parentde09276c71084e73b955f72ddbf750e5d63d8aa2 (diff)
downloadportage-b484ce5218c988151416065ad86af2599838b77f.tar.gz
portage-b484ce5218c988151416065ad86af2599838b77f.tar.bz2
portage-b484ce5218c988151416065ad86af2599838b77f.zip
reposyntax: Next try at fixing the package cache
-rw-r--r--pym/_emerge/FakeVartree.py6
-rw-r--r--pym/_emerge/depgraph.py16
2 files changed, 20 insertions, 2 deletions
diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py
index 64a39cf4d..b7b089338 100644
--- a/pym/_emerge/FakeVartree.py
+++ b/pym/_emerge/FakeVartree.py
@@ -200,7 +200,11 @@ class FakeVartree(vartree):
mycounter = 0
pkg.metadata["COUNTER"] = str(mycounter)
- self._pkg_cache[pkg] = pkg
+ #For installed (and binary) packages we don't care for the repo when it comes to
+ #caching, because there can only be one cpv. So overwrite the repo key with type_name.
+ #Make sure that .operation is computed.
+ pkg._get_hash_key()
+ self._pkg_cache[(pkg.type_name, pkg.root, pkg.cpv, pkg.operation, pkg.type_name)] = pkg
return pkg
def grab_global_updates(portdb):
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index aa53ec352..b28f2fe59 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -3250,6 +3250,11 @@ class depgraph(object):
failures for some reason (package does not exist or is
corrupt).
"""
+ if type_name == "ebuild" and myrepo is None:
+ raise ValueError("Need repository to create Package for ebuild.")
+ elif myrepo is None:
+ myrepo = type_name
+
operation = "merge"
if installed or onlydeps:
operation = "nomerge"
@@ -3275,7 +3280,16 @@ class depgraph(object):
pkg = Package(built=(type_name != "ebuild"), cpv=cpv,
installed=installed, metadata=metadata, onlydeps=onlydeps,
root_config=root_config, type_name=type_name)
- self._frozen_config._pkg_cache[pkg] = pkg
+
+ if type_name == "ebuild":
+ self._frozen_config._pkg_cache[pkg] = pkg
+ else:
+ #For installed and binary packages we don't care for the repo when it comes to
+ #caching, because there can only be one cpv. So overwrite the repo key with type_name.
+ #Make sure that .operation is computed.
+ pkg._get_hash_key()
+ self._frozen_config._pkg_cache[
+ (pkg.type_name, pkg.root, pkg.cpv, pkg.operation, pkg.type_name)] = pkg
if not self._pkg_visibility_check(pkg) and \
'LICENSE' in pkg.masks and len(pkg.masks) == 1: