portdbapi: DeprecationWarning for 'pms' cache
authorZac Medico <zmedico@gentoo.org>
Tue, 27 Nov 2012 16:23:46 +0000 (08:23 -0800)
committerZac Medico <zmedico@gentoo.org>
Tue, 27 Nov 2012 16:23:46 +0000 (08:23 -0800)
pym/portage/dbapi/porttree.py
pym/portage/repository/config.py
pym/portage/tests/dbapi/test_portdb_cache.py
pym/portage/tests/emerge/test_simple.py

index 115fc7f298cff680f9ad091f89a8f825bb554a42..9f0140cdf0c85cd245495e688dd4fe9c71e4ee71 100644 (file)
@@ -204,6 +204,13 @@ class portdbapi(dbapi):
                                cache.ec = self.repositories.get_repo_for_location(tree).eclass_db
                        except AttributeError:
                                pass
+
+                       if not cache.complete_eclass_entries:
+                               warnings.warn(
+                                       ("Repository '%s' used deprecated 'pms' cache format. "
+                                       "Please migrate to 'md5-dict' format.") % (conf.name,),
+                                       DeprecationWarning)
+
                return cache
 
        def _init_cache_dirs(self):
index 246be0e8c6cd884933db58193fd0ba019f66ff8f..3d29fd924f6879a43fd3673297f3f0687ed410c4 100644 (file)
@@ -201,7 +201,7 @@ class RepoConfig(object):
                        if not force:
                                return
                        # The default egencache format was 'pms' prior to portage-2.1.11.32
-                       # (portage versions ersions prior to portage-2.1.11.14 will NOT
+                       # (portage versions prior to portage-2.1.11.14 will NOT
                        # recognize md5-dict format unless it is explicitly listed in
                        # layout.conf).
                        formats = ('md5-dict',)
index 3290d08e59365dfab811295430b17f467f001d05..67b961aeb90afd64a1571907034beaaadabea5b0 100644 (file)
@@ -82,15 +82,17 @@ class PortdbCacheTestCase(TestCase):
                                        sys.exit(1)
                        """),),
 
+                       # Don't use python -Wd, since the pms format triggers deprecation warnings
+                       # in portdbapi._create_pregen_cache().
                        (BASH_BINARY, "-c", "echo %s > %s" %
                                tuple(map(portage._shell_quote,
                                ("cache-formats = pms md5-dict", layout_conf_path,)))),
-                       python_cmd + (textwrap.dedent("""
+                       (portage_python, "-c") + (textwrap.dedent("""
                                import os, sys, portage
                                if portage.portdb.porttree_root not in portage.portdb._pregen_auxdb:
                                        sys.exit(1)
                        """),),
-                       python_cmd + (textwrap.dedent("""
+                       (portage_python, "-c") + (textwrap.dedent("""
                                import os, sys, portage
                                from portage.cache.metadata import database as pms_database
                                if not isinstance(portage.portdb._pregen_auxdb[portage.portdb.porttree_root], pms_database):
@@ -173,6 +175,6 @@ class PortdbCacheTestCase(TestCase):
                                                        sys.stderr.write(_unicode_decode(line))
 
                                self.assertEqual(os.EX_OK, proc.returncode,
-                                       "command failed with args %s" % (args,))
+                                       "command %d failed with args %s" % (i, args,))
                finally:
                        playground.cleanup()
index 56fbdb3bfa8bac00db8b79891967f5f8b71f4989..a22e2b37d3dfecf45c5e1ddfec99ec07fe064a22 100644 (file)
@@ -162,7 +162,7 @@ pkg_preinst() {
                portdir = settings["PORTDIR"]
                var_cache_edb = os.path.join(eprefix, "var", "cache", "edb")
                cachedir = os.path.join(var_cache_edb, "dep")
-               cachedir_pregen = os.path.join(portdir, "metadata", "cache")
+               cachedir_pregen = os.path.join(portdir, "metadata", "md5-cache")
 
                portage_python = portage._python_interpreter
                ebuild_cmd = (portage_python, "-Wd",