egencache: skip auxdb write if not metadata-trans
authorZac Medico <zmedico@gentoo.org>
Sat, 15 Sep 2012 16:53:42 +0000 (09:53 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 15 Sep 2012 16:53:42 +0000 (09:53 -0700)
bin/egencache
pym/_emerge/EbuildMetadataPhase.py
pym/_emerge/MetadataRegen.py

index 00356745250d0d62ce9e134e152d59eb0e554947..ec62a8c08ed5418b936d66f1a27eef1ed3751f42 100755 (executable)
@@ -212,9 +212,11 @@ class GenCache(object):
                else:
                        self._cp_set = None
                        self._cp_missing = set()
+               write_auxdb = "metadata-transfer" in portdb.settings.features
                self._regen = MetadataRegen(portdb, cp_iter=cp_iter,
                        consumer=self._metadata_callback,
-                       max_jobs=max_jobs, max_load=max_load)
+                       max_jobs=max_jobs, max_load=max_load,
+                       write_auxdb=write_auxdb)
                self.returncode = os.EX_OK
                conf = portdb.repositories.get_repo_for_location(tree)
                self._trg_caches = tuple(conf.iter_pregenerated_caches(
index 669b4ae2e91eb5847df33f835f8a4db509db9dbb..1ffa1bb238a92b39ccaa071e09406c9484157736 100644 (file)
@@ -25,7 +25,7 @@ class EbuildMetadataPhase(SubProcess):
        """
 
        __slots__ = ("cpv", "eapi_supported", "ebuild_hash", "fd_pipes",
-               "metadata", "portdb", "repo_path", "settings") + \
+               "metadata", "portdb", "repo_path", "settings", "write_auxdb") + \
                ("_eapi", "_eapi_lineno", "_raw_metadata",)
 
        _file_names = ("ebuild",)
@@ -180,8 +180,11 @@ class EbuildMetadataPhase(SubProcess):
                                                metadata["_eclasses_"] = {}
                                        metadata.pop("INHERITED", None)
 
-                                       self.portdb._write_cache(self.cpv,
-                                               self.repo_path, metadata, self.ebuild_hash)
+                                       # If called by egencache, this cache write is
+                                       # undesirable when metadata-transfer is disabled.
+                                       if self.write_auxdb is not False:
+                                               self.portdb._write_cache(self.cpv,
+                                                       self.repo_path, metadata, self.ebuild_hash)
                                else:
                                        metadata = {"EAPI": metadata["EAPI"]}
                                self.metadata = metadata
index e82015fd12eb6d879c579c76431d7b9bee1c0729..234298f7ead6203ba07ee8e4dd6f027cd2952fe2 100644 (file)
@@ -10,9 +10,10 @@ from _emerge.PollScheduler import PollScheduler
 class MetadataRegen(PollScheduler):
 
        def __init__(self, portdb, cp_iter=None, consumer=None,
-               max_jobs=None, max_load=None):
+               max_jobs=None, max_load=None, write_auxdb=True):
                PollScheduler.__init__(self, main=True)
                self._portdb = portdb
+               self._write_auxdb = write_auxdb
                self._global_cleanse = False
                if cp_iter is None:
                        cp_iter = self._iter_every_cp()
@@ -84,7 +85,8 @@ class MetadataRegen(PollScheduler):
                                        yield EbuildMetadataPhase(cpv=cpv,
                                                ebuild_hash=ebuild_hash,
                                                portdb=portdb, repo_path=repo_path,
-                                               settings=portdb.doebuild_settings)
+                                               settings=portdb.doebuild_settings,
+                                               write_auxdb=self._write_auxdb)
 
        def _keep_scheduling(self):
                return self._remaining_tasks and not self._terminated_tasks