From: Zac Medico Date: Sat, 21 Jun 2008 14:58:13 +0000 (-0000) Subject: Make LibraryConsumerSet.mapPathsToAtoms() use the contents index for more X-Git-Tag: v2.2_rc2~360 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f424cc99fc4e2d36ac9a8eee6be09711c46fa4d5;p=portage.git Make LibraryConsumerSet.mapPathsToAtoms() use the contents index for more efficient owner lookups. svn path=/main/trunk/; revision=10754 --- 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):