commit:     7bef8d93aa79ad7a4001e30c74f7aa267ac95771
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 24 11:19:32 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Dec 29 16:40:02 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7bef8d93

sqlite: enable md5 validation (bug 568934)

Add forward-compatibility for cache entries containing md5 digests
instead of mtimes for validation.

X-Gentoo-Bug: 568934
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=568934
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>

 pym/portage/cache/sqlite.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py
index 310ac94..32e4076 100644
--- a/pym/portage/cache/sqlite.py
+++ b/pym/portage/cache/sqlite.py
@@ -18,6 +18,9 @@ if sys.hexversion >= 0x3000000:
 
 class database(fs_template.FsBased):
 
+       validation_chf = 'mtime'
+       chf_types = ('mtime', 'md5')
+
        autocommits = False
        synchronous = False
        # cache_bytes is used together with page_size (set at sqlite build time)
@@ -28,10 +31,12 @@ class database(fs_template.FsBased):
        def __init__(self, *args, **config):
                super(database, self).__init__(*args, **config)
                self._import_sqlite()
-               self._allowed_keys = ["_mtime_", "_eclasses_"]
+               self._allowed_keys = ["_eclasses_"]
                self._allowed_keys.extend(self._known_keys)
-               self._allowed_keys.sort()
+               self._allowed_keys.extend('_%s_' % k for k in self.chf_types)
                self._allowed_keys_set = frozenset(self._allowed_keys)
+               self._allowed_keys = sorted(self._allowed_keys_set)
+
                self.location = os.path.join(self.location, 
                        self.label.lstrip(os.path.sep).rstrip(os.path.sep))
 

Reply via email to