diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-12-16 02:10:05 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-12-16 02:10:05 +0000 |
commit | 25ded51d2804109347a3a6fa96ef44e4a7833df0 (patch) | |
tree | 1fbf8e7336ab98e3f66d76bb2fd0e80a3d41d04c | |
parent | 30052a08065650154917870f367fd574620d75fc (diff) | |
download | portage-25ded51d2804109347a3a6fa96ef44e4a7833df0.tar.gz portage-25ded51d2804109347a3a6fa96ef44e4a7833df0.tar.bz2 portage-25ded51d2804109347a3a6fa96ef44e4a7833df0.zip |
Cache KEYWORDS and EAPI metadata values in order to speed up portdbapi.gvisible() calls. This greatly improves repoman performance (help emerge a little too).
svn path=/main/trunk/; revision=5298
-rw-r--r-- | pym/portage.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/pym/portage.py b/pym/portage.py index 3e77d53c3..d2c81798f 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5163,6 +5163,7 @@ class portdbapi(dbapi): for x in self.porttrees: # location, label, auxdbkeys self.auxdb[x] = self.auxdbmodule(self.depcachedir, x, filtered_auxdbkeys, gid=portage_gid) + self._gvisible_aux_cache = {} def _init_cache_dirs(self): """Create /var/cache/edb/dep and adjust permissions for the portage @@ -5682,15 +5683,20 @@ class portdbapi(dbapi): #we need to update this next line when we have fully integrated the new db api auxerr=0 keys = None - try: - keys, eapi = self.aux_get(mycpv, ["KEYWORDS", "EAPI"]) - except KeyError: - pass - except portage_exception.PortageException, e: - writemsg("!!! Error: aux_get('%s', ['KEYWORDS', 'EAPI'])\n" % mycpv, - noiselevel=-1) - writemsg("!!! %s\n" % str(e), - noiselevel=-1) + aux_cache = self._gvisible_aux_cache.get(mycpv) + if aux_cache is not None: + keys, eapi = aux_cache + else: + try: + keys, eapi = self.aux_get(mycpv, ["KEYWORDS", "EAPI"]) + except KeyError: + pass + except portage_exception.PortageException, e: + writemsg("!!! Error: aux_get('%s', ['KEYWORDS', 'EAPI'])\n" % mycpv, + noiselevel=-1) + writemsg("!!! %s\n" % str(e), + noiselevel=-1) + self._gvisible_aux_cache[mycpv] = (keys, eapi) if not keys: # KEYWORDS="" #print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status" |