diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-11-16 08:43:10 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-11-16 08:43:10 +0000 |
commit | 05a388421c57c36f704b669d724567f9cfa81aaf (patch) | |
tree | b26f6db9d33ebbf9aae26ec8614c1989a554b307 | |
parent | 72178ba6b9b68766f4596cc51ad9d5ae91680f42 (diff) | |
download | portage-05a388421c57c36f704b669d724567f9cfa81aaf.tar.gz portage-05a388421c57c36f704b669d724567f9cfa81aaf.tar.bz2 portage-05a388421c57c36f704b669d724567f9cfa81aaf.zip |
Speed up LibraryPackageMap.update() by pulling NEEDED from the
vardbapi.aux_get() cache. This greatly reduces the amount of
needless IO that has been happening just prior to the postinst
phase in dblink.treewalk(). We may want to consider having
LibraryPackageMap work directly from the vardbapi instead of
creating the intermediate /var/cache/edb/library_consumers file.
svn path=/main/trunk/; revision=8516
-rw-r--r-- | pym/portage/dbapi/vartree.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index a35fcee4e..aa8c75a50 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -146,8 +146,9 @@ class LibraryPackageMap(object): def update(self): """ Update the global library->consumer map for the given vdb instance. """ obj_dict = {} + aux_get = self._dbapi.aux_get for cpv in self._dbapi.cpv_all(): - needed_list = grabfile(self._dbapi.getpath(cpv, "NEEDED")) + needed_list = aux_get(cpv, ["NEEDED"])[0].splitlines() for l in needed_list: mysplit = l.split() if len(mysplit) < 2: @@ -517,6 +518,12 @@ class vardbapi(dbapi): cache_valid = cache_mtime == mydir_mtime if cache_valid: cache_incomplete = self._aux_cache_keys.difference(metadata) + needed = metadata.get("NEEDED") + if needed is None or "\n" not in needed: + # Cached value has whitespace filtered, so it has to be pulled + # again. This is temporary migration code which can be removed + # later, since it only affects users who are running trunk. + cache_incomplete.add("NEEDED") if cache_incomplete: # Allow self._aux_cache_keys to change without a cache version # bump and efficiently recycle partial cache whenever possible. @@ -558,7 +565,8 @@ class vardbapi(dbapi): myd = myf.read() finally: myf.close() - myd = " ".join(myd.split()) + if x != "NEEDED": + myd = " ".join(myd.split()) except IOError: myd = "" if x == "EAPI" and not myd: |