summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-10-26 18:06:07 +0000
committerZac Medico <zmedico@gentoo.org>2007-10-26 18:06:07 +0000
commit9915319b594ce940893a7449fec755b24ea73d50 (patch)
treecc15011bd9d41664b4d081bde60174867352dc3e /pym
parent33adea25f18c496592b4505a582bbb64af647eac (diff)
downloadportage-9915319b594ce940893a7449fec755b24ea73d50.tar.gz
portage-9915319b594ce940893a7449fec755b24ea73d50.tar.bz2
portage-9915319b594ce940893a7449fec755b24ea73d50.zip
Optimize repoman to share portdbapi.cp_list() results
between all profiles since those results never change. The cached results also propagate to the xmatch match-all when appropriate (old-style virtuals are excluded since they are profile dependent). svn path=/main/trunk/; revision=8313
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/porttree.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index f0cc49ac2..4f9b1cbbe 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -494,10 +494,15 @@ class portdbapi(dbapi):
def cp_list(self, mycp, use_cache=1, mytree=None):
if self.frozen and mytree is None:
- mylist = self.xcache["match-all"].get(mycp)
- # cp_list() doesn't expand old-style virtuals
- if mylist and mylist[0].startswith(mycp):
- return mylist[:]
+ cachelist = self.xcache["cp-list"].get(mycp)
+ if cachelist is not None:
+ # Try to propagate this to the match-all cache here for
+ # repoman since he uses separate match-all caches for each
+ # profile (due to old-style virtuals). Do not propagate
+ # old-style virtuals since cp_list() doesn't expand them.
+ if not (not cachelist and mycp.startswith("virtual/")):
+ self.xcache["match-all"][mycp] = cachelist
+ return cachelist[:]
mysplit = mycp.split("/")
invalid_category = mysplit[0] not in self._categories
d={}
@@ -535,12 +540,16 @@ class portdbapi(dbapi):
cpv = cat + "/" + pn + "-" + ver + "-" + rev
mylist[i] = cpv
if self.frozen and mytree is None:
- if not (not mylist and mycp.startswith("virtual/")):
- self.xcache["match-all"][mycp] = mylist[:]
+ cachelist = mylist[:]
+ self.xcache["cp-list"][mycp] = cachelist
+ # Do not propagate old-style virtuals since
+ # cp_list() doesn't expand them.
+ if not (not cachelist and mycp.startswith("virtual/")):
+ self.xcache["match-all"][mycp] = cachelist
return mylist
def freeze(self):
- for x in "bestmatch-visible", "list-visible", "match-all", \
+ for x in "bestmatch-visible", "cp-list", "list-visible", "match-all", \
"match-visible", "minimum-all", "minimum-visible":
self.xcache[x]={}
self.frozen=1