summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-10-10 06:33:28 +0000
committerZac Medico <zmedico@gentoo.org>2007-10-10 06:33:28 +0000
commit66b682321273f34361659d3eac568b2d9fd975d4 (patch)
tree00ed3bbb7eee6265dc01fb581c9fda15ac2216c9
parentb85dfc271ab0f9f7077c8dcde465b74166355d5d (diff)
downloadportage-66b682321273f34361659d3eac568b2d9fd975d4.tar.gz
portage-66b682321273f34361659d3eac568b2d9fd975d4.tar.bz2
portage-66b682321273f34361659d3eac568b2d9fd975d4.zip
Cache IUSE in bindbapi to optimize --newuse calculations.
Also, fix filtering code for reading/writing USE and IUSE from/to the metadata index. svn path=/main/trunk/; revision=8036
-rw-r--r--pym/portage/dbapi/bintree.py8
-rw-r--r--pym/portage/getbinpkg.py4
2 files changed, 11 insertions, 1 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index c2218cd09..e62bfee15 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -26,7 +26,7 @@ class bindbapi(fakedbapi):
self.cpdict={}
# Selectively cache metadata in order to optimize dep matching.
self._aux_cache_keys = set(
- ["CHOST", "EAPI", "KEYWORDS", "LICENSE", "SLOT", "USE"])
+ ["CHOST", "EAPI", "IUSE", "KEYWORDS", "LICENSE", "SLOT", "USE"])
self._aux_cache = {}
def match(self, *pargs, **kwargs):
@@ -502,6 +502,12 @@ class binarytree(object):
d.update(izip(aux_keys,
self.dbapi.aux_get(mycpv, aux_keys)))
+ use = d["USE"].split()
+ iuse = set(d["IUSE"].split())
+ use = [f for f in use if f in iuse]
+ use.sort()
+ d["USE"] = " ".join(use)
+
# record location if it's non-default
if mypath != mycpv + ".tbz2":
d["PATH"] = mypath
diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
index 977693c6d..61042fde7 100644
--- a/pym/portage/getbinpkg.py
+++ b/pym/portage/getbinpkg.py
@@ -686,7 +686,9 @@ class PackageIndex(object):
if not mycpv:
continue
d.setdefault("EAPI", "0")
+ d.setdefault("IUSE", "")
d.setdefault("SLOT", "0")
+ d.setdefault("USE", "")
if header_chost:
d.setdefault("CHOST", header_chost)
self.packages[mycpv] = d
@@ -707,6 +709,8 @@ class PackageIndex(object):
del metadata["CHOST"]
if metadata.get("EAPI") == "0":
del metadata["EAPI"]
+ if metadata.get("IUSE") == "":
+ del metadata["IUSE"]
if metadata.get("SLOT") == "0":
del metadata["SLOT"]
if metadata.get("USE") == "":