diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-06-09 15:34:21 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-06-09 15:34:21 +0000 |
commit | 3ba595090de65c3d1eef2c9c6ad99f50f8b8c911 (patch) | |
tree | e93a91a25deff8801da4f4ae89991b6de2701cba /bin/emerge | |
parent | 48452a4675c33b7b344df217ee3cb4753e2ecd04 (diff) | |
download | portage-3ba595090de65c3d1eef2c9c6ad99f50f8b8c911.tar.gz portage-3ba595090de65c3d1eef2c9c6ad99f50f8b8c911.tar.bz2 portage-3ba595090de65c3d1eef2c9c6ad99f50f8b8c911.zip |
Add CONTENTS indexing support for optimization of owner lookups. The
vardbapi cache maintains a hash table (inside vdb_metadata.pickle)
that serves to index package contents by mapping the basename of file
to a list of possible packages that own it. This is used to optimize
owner lookups by narrowing the search down to a smaller number of
packages. It increases the size of vdb_metadata.pickle by approximately
30% and it's used in the following cases:
* When an unexpected file collision occurs (whether
or not collision-protect is enabled)
* `emerge <filename>`
* `portageq owners`
(trunk r10609)
svn path=/main/branches/2.1.2/; revision=10622
Diffstat (limited to 'bin/emerge')
-rwxr-xr-x | bin/emerge | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/bin/emerge b/bin/emerge index 1ab502d73..6b11bacff 100755 --- a/bin/emerge +++ b/bin/emerge @@ -2679,6 +2679,7 @@ class depgraph(object): myroot = self.target_root dbs = self._filtered_trees[myroot]["dbs"] vardb = self.trees[myroot]["vartree"].dbapi + real_vardb = self._trees_orig[myroot]["vartree"].dbapi portdb = self.trees[myroot]["porttree"].dbapi bindb = self.trees[myroot]["bintree"].dbapi pkgsettings = self.pkgsettings[myroot] @@ -2757,16 +2758,12 @@ class depgraph(object): " $ROOT.\n") % x, noiselevel=-1) return 0, [] relative_path = x[len(myroot):] - vartree = self._trees_orig[myroot]["vartree"] owner_cpv = None - for cpv in vardb.cpv_all(): - self.spinner.update() - cat, pf = portage.catsplit(cpv) - if portage.dblink(cat, pf, myroot, - pkgsettings, vartree=vartree).isowner( - relative_path, myroot): - owner_cpv = cpv - break + for pkg, relative_path in \ + real_vardb._owners.iter_owners([relative_path]): + owner_cpv = pkg.mycpv + break + if owner_cpv is None: portage.writemsg(("\n\n!!! '%s' is not claimed " + \ "by any package.\n") % x, noiselevel=-1) |