summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-10 05:58:59 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-10 05:58:59 +0000
commit6cc00751a75964949277484ebe1a437c5278c532 (patch)
tree31199f21356a6a421fe7761ad8a99ed0229ad033 /pym
parent700947d704f4c46410f2874938a531a87772c20f (diff)
downloadportage-6cc00751a75964949277484ebe1a437c5278c532.tar.gz
portage-6cc00751a75964949277484ebe1a437c5278c532.tar.bz2
portage-6cc00751a75964949277484ebe1a437c5278c532.zip
* Make depclean/prune use cached Package instances for visibility checks.
* Make FakeVartree wrap dbapi.match() to make sure the metadata in Package instances gets updated for any cpv that is returned from a match() call, since the metadata can be accessed directly from the Package instance instead of via aux_get(). svn path=/main/trunk/; revision=9789
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/__init__.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index a13ad7225..30df7cb4d 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -1026,11 +1026,27 @@ class FakeVartree(portage.vartree):
# being delayed in case cache generation is triggered.
self._aux_get = self.dbapi.aux_get
self.dbapi.aux_get = self._aux_get_wrapper
+ self._match = self.dbapi.match
+ self.dbapi.match = self._match_wrapper
self._aux_get_history = set()
self._portdb_keys = ["DEPEND", "RDEPEND", "PDEPEND"]
self._portdb = portdb
self._global_updates = None
+ def _match_wrapper(self, cpv, use_cache=1):
+ """
+ Make sure the metadata in Package instances gets updated for any
+ cpv that is returned from a match() call, since the metadata can
+ be accessed directly from the Package instance instead of via
+ aux_get().
+ """
+ matches = self._match(cpv, use_cache=use_cache)
+ for cpv in matches:
+ if cpv in self._aux_get_history:
+ continue
+ self._aux_get_wrapper(cpv, [])
+ return matches
+
def _aux_get_wrapper(self, pkg, wants):
if pkg in self._aux_get_history:
return self._aux_get(pkg, wants)
@@ -6683,10 +6699,8 @@ def action_depclean(settings, trees, ldpath_mtimes,
# For consistency with the update algorithm, keep the highest
# visible version and prune any versions that are old or masked.
for cpv in reversed(pkgs):
- metadata = dict(izip(metadata_keys,
- vardb.aux_get(cpv, metadata_keys)))
- if visible(settings, Package(built=True, cpv=cpv,
- installed=True, metadata=metadata, type_name="installed")):
+ if visible(settings,
+ pkg_cache[("installed", myroot, cpv, "nomerge")]):
pkgs = [cpv]
break
if len(pkgs) > 1: