diff options
author | Zac Medico <zmedico@gentoo.org> | 2015-12-24 03:19:32 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2015-12-29 08:40:02 -0800 |
commit | 7bef8d93aa79ad7a4001e30c74f7aa267ac95771 (patch) | |
tree | f906ae244844788f75f1f5180307e6f0b0992fac | |
parent | template.database.__getitem__: allow missing mtime (bug 568934) (diff) | |
download | portage-7bef8d93.tar.gz portage-7bef8d93.tar.bz2 portage-7bef8d93.zip |
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@gentoo.org>
-rw-r--r-- | pym/portage/cache/sqlite.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py index 310ac9460..32e407635 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)) |