emerge --metadata: fix breakage
authorZac Medico <zmedico@gentoo.org>
Sat, 15 Oct 2011 05:10:28 +0000 (22:10 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 15 Oct 2011 05:10:28 +0000 (22:10 -0700)
The hunk that got removed from action_metadata in commit
d4ea29bf6a3ce35d49e0f54f9173e3a6e42da2d6 is actually needed when
FEATURES=metadata-transfer is enabled.

pym/_emerge/actions.py
pym/portage/dbapi/porttree.py

index c449b5874afe0fc1981d35796a48fa8a74fd59d8..71a09023321a3ca9e12a16835ae0de901b2c8435 100644 (file)
@@ -1660,6 +1660,10 @@ def action_metadata(settings, portdb, myopts, porttrees=None):
        porttrees_data = []
        for path in porttrees:
                src_db = portdb._pregen_auxdb.get(path)
+               if src_db is None:
+                       # portdbapi does not populate _pregen_auxdb
+                       # when FEATURES=metadata-transfer is enabled
+                       src_db = portdb._create_pregen_cache(path)
 
                if src_db is not None:
                        porttrees_data.append(TreeData(portdb.auxdb[path],
index bffae36bd2b90788f408aa2d7ceba1d333fab4df..36b326c14481f7f26ec4afb332c38b07abc0ed56 100644 (file)
@@ -182,6 +182,8 @@ class portdbapi(dbapi):
                # ~harring
                filtered_auxdbkeys = [x for x in auxdbkeys if not x.startswith("UNUSED_0")]
                filtered_auxdbkeys.sort()
+               filtered_auxdbkeys = tuple(filtered_auxdbkeys)
+               self._filtered_auxdbkeys = filtered_auxdbkeys
                # If secpass < 1, we don't want to write to the cache
                # since then we won't be able to apply group permissions
                # to the cache entries/directories.
@@ -212,14 +214,9 @@ class portdbapi(dbapi):
                        for x in self.porttrees:
                                if x in self._pregen_auxdb:
                                        continue
-                               conf = self.repositories.get_repo_for_location(x)
-                               cache = conf.get_pregenerated_cache(filtered_auxdbkeys, readonly=True)
+                               cache = self._create_pregen_cache(x)
                                if cache is not None:
                                        self._pregen_auxdb[x] = cache
-                                       try:
-                                               cache.ec = self._repo_info[x].eclass_db
-                                       except AttributeError:
-                                               pass
                # Selectively cache metadata in order to optimize dep matching.
                self._aux_cache_keys = set(
                        ["DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS", "LICENSE",
@@ -229,6 +226,17 @@ class portdbapi(dbapi):
                self._aux_cache = {}
                self._broken_ebuilds = set()
 
+       def _create_pregen_cache(self, tree):
+               conf = self.repositories.get_repo_for_location(tree)
+               cache = conf.get_pregenerated_cache(
+                       self._filtered_auxdbkeys, readonly=True)
+               if cache is not None:
+                       try:
+                               cache.ec = self._repo_info[tree].eclass_db
+                       except AttributeError:
+                               pass
+               return cache
+
        def _init_cache_dirs(self):
                """Create /var/cache/edb/dep and adjust permissions for the portage
                group."""