From: Zac Medico Date: Tue, 27 Nov 2012 15:45:53 +0000 (-0800) Subject: egencache: enable md5-dict format by default X-Git-Tag: v2.2.0_alpha143~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e760c8d2a4ccc56e351ac37904c715f596b58e42;p=portage.git egencache: enable md5-dict format by default WARNING: Portage versions prior to portage-2.1.11.14 will NOT recognize the 'md5-dict' format unless it is explicitly listed in metadata/layout.conf (refer to portage(5) for example usage). WARNING: For backward compatibility, the obsolete 'pms' cache format will still be generated by default if the metadata/cache/ directory exists in the repository. --- diff --git a/man/egencache.1 b/man/egencache.1 index bc5db6729..57a509d6e 100644 --- a/man/egencache.1 +++ b/man/egencache.1 @@ -108,10 +108,10 @@ contains will be added to the beginning of the command line on every invocation. These options will not be added if the \fB\-\-ignore-default\-opts\fR option is specified. .SH "BUGS" -There are significant limitations associated with the metadata -cache format that is distributed in the \fImetadata/cache/\fR directory -of the repository. These limitations are related to the cache validation -mechanism. Currently, the validation mechanism involves comparison of +Prior to portage-2.1.11.32, the 'pms' cache format was enabled by default. +This 'pms' format, which is distributed in the \fImetadata/cache/\fR +directory of the repository, has significant limitations related to the +cache validation mechanism which involves comparison of a cache entry mtime to the mtime of the corresponding \fBebuild(5)\fR. This mechanism is unreliable in cases when eclass changes result in metadata changes, since no information about eclass state is available in the cache. @@ -123,11 +123,21 @@ implemented in \fBemerge\fR(1) \fB\-\-sync\fR which updates ebuild mtimes to match their corresponding cache entries (except for ebuilds that are modified relative to HEAD). -In order to solve the above problems, a future extension -to the cache format will include additional -validation data in the form of digests for both the ebuild -and its inherited eclasses. Until the -cache format has been extended in this way, it is necessary to enable +In order to solve the above problems, the newer 'md5-dict' format has been +enabled by default since portage-2.1.11.32. This format is distributed in +the \fImetadata/md5-cache/\fR directory of the repository, and includes +additional validation data in the form of digests for both the ebuild +and its inherited eclasses. \fBWARNING:\fR Portage versions prior to +portage-2.1.11.14 will \fBNOT\fR recognize the 'md5-dict' format unless it is +explicitly listed in \fImetadata/layout.conf\fR (refer to \fBportage\fR(5) +for example usage). + +\fBWARNING:\fR For backward compatibility, the obsolete 'pms' cache format +will still be generated by default if the \fImetadata/cache/\fR directory +exists in the repository. It can also be explicitly enabled via the +cache\-formats setting in \fImetadata/layout.conf\fR (refer to \fBportage\fR(5) +for example usage). If the 'pms' cache format is enabled and the 'md5-dict' +format is not enabled, then it is necessary to enable \fBmetadata-transfer\fR in \fBFEATURES\fR (see \fBmake.conf(5)\fR). This causes intermediate cache (in a different format that includes eclass state) to be generated inside the directory which is configurable diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 71f548ca4..246be0e8c 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -200,7 +200,11 @@ class RepoConfig(object): if not formats: if not force: return - formats = ('pms',) + # 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 + # recognize md5-dict format unless it is explicitly listed in + # layout.conf). + formats = ('md5-dict',) for fmt in formats: name = None @@ -739,8 +743,11 @@ def parse_layout_conf(repo_location, repo_name=None): cache_formats = layout_data.get('cache-formats', '').lower().split() if not cache_formats: # Auto-detect cache formats, and prefer md5-cache if available. - # After this behavior is deployed in stable portage, the default - # egencache format can be changed to md5-dict. + # This behavior was deployed in portage-2.1.11.14, so that the + # default egencache format could eventually be changed to md5-dict + # in portage-2.1.11.32. WARNING: Versions prior to portage-2.1.11.14 + # will NOT recognize md5-dict format unless it is explicitly + # listed in layout.conf. cache_formats = [] if os.path.isdir(os.path.join(repo_location, 'metadata', 'md5-cache')): cache_formats.append('md5-dict') diff --git a/pym/portage/tests/dbapi/test_portdb_cache.py b/pym/portage/tests/dbapi/test_portdb_cache.py index 6526246e1..3290d08e5 100644 --- a/pym/portage/tests/dbapi/test_portdb_cache.py +++ b/pym/portage/tests/dbapi/test_portdb_cache.py @@ -51,8 +51,8 @@ class PortdbCacheTestCase(TestCase): """),), egencache_cmd + ("--update",), - (lambda: os.path.exists(pms_cache_dir),), - (lambda: not os.path.exists(md5_cache_dir),), + (lambda: not os.path.exists(pms_cache_dir),), + (lambda: os.path.exists(md5_cache_dir),), python_cmd + (textwrap.dedent(""" import os, sys, portage if portage.portdb.porttree_root not in portage.portdb._pregen_auxdb: @@ -60,8 +60,8 @@ class PortdbCacheTestCase(TestCase): """),), python_cmd + (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): + from portage.cache.flat_hash import md5_database + if not isinstance(portage.portdb._pregen_auxdb[portage.portdb.porttree_root], md5_database): sys.exit(1) """),),