diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-06-21 14:58:13 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-06-21 14:58:13 +0000 |
commit | f424cc99fc4e2d36ac9a8eee6be09711c46fa4d5 (patch) | |
tree | 58088219f705b33cb44ebceacab7eacc6c6ee086 | |
parent | ec706a264214a30639665f60128257ccd9e9e978 (diff) | |
download | portage-f424cc99fc4e2d36ac9a8eee6be09711c46fa4d5.tar.gz portage-f424cc99fc4e2d36ac9a8eee6be09711c46fa4d5.tar.bz2 portage-f424cc99fc4e2d36ac9a8eee6be09711c46fa4d5.zip |
Make LibraryConsumerSet.mapPathsToAtoms() use the contents index for more
efficient owner lookups.
svn path=/main/trunk/; revision=10754
-rw-r--r-- | pym/portage/sets/libs.py | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/pym/portage/sets/libs.py b/pym/portage/sets/libs.py index 774ef5ac4..e8d6a6107 100644 --- a/pym/portage/sets/libs.py +++ b/pym/portage/sets/libs.py @@ -4,10 +4,7 @@ from portage.sets.base import PackageSet from portage.sets import get_boolean -from portage.dbapi.vartree import dblink -from portage.versions import catsplit, catpkgsplit - -import os +from portage.versions import catpkgsplit class LibraryConsumerSet(PackageSet): _operations = ["merge", "unmerge"] @@ -19,17 +16,13 @@ class LibraryConsumerSet(PackageSet): def mapPathsToAtoms(self, paths): rValue = set() - for cpv in self.dbapi.cpv_all(): - mysplit = catsplit(cpv) - link = dblink(mysplit[0], mysplit[1], myroot=self.dbapi.root, \ - mysettings=self.dbapi.settings, treetype='vartree', \ - vartree=self.dbapi.vartree) - if paths.intersection(link.getcontents()): - cat, pn = catpkgsplit(cpv)[:2] - slot = self.dbapi.aux_get(cpv, ["SLOT"])[0] - rValue.add("%s/%s:%s" % (cat, pn, slot)) + root_len = len(self.dbapi.root) + for link, relative_p in self.dbapi._owners.iter_owners( + p[root_len:] for p in paths): + cat, pn = catpkgsplit(link.mycpv)[:2] + slot = self.dbapi.aux_get(link.mycpv, ["SLOT"])[0] + rValue.add("%s/%s:%s" % (cat, pn, slot)) return rValue - class PreservedLibraryConsumerSet(LibraryConsumerSet): def load(self): |