1 |
commit: 7bef8d93aa79ad7a4001e30c74f7aa267ac95771 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 24 11:19:32 2015 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 29 16:40:02 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7bef8d93 |
7 |
|
8 |
sqlite: enable md5 validation (bug 568934) |
9 |
|
10 |
Add forward-compatibility for cache entries containing md5 digests |
11 |
instead of mtimes for validation. |
12 |
|
13 |
X-Gentoo-Bug: 568934 |
14 |
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=568934 |
15 |
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org> |
16 |
|
17 |
pym/portage/cache/sqlite.py | 9 +++++++-- |
18 |
1 file changed, 7 insertions(+), 2 deletions(-) |
19 |
|
20 |
diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py |
21 |
index 310ac94..32e4076 100644 |
22 |
--- a/pym/portage/cache/sqlite.py |
23 |
+++ b/pym/portage/cache/sqlite.py |
24 |
@@ -18,6 +18,9 @@ if sys.hexversion >= 0x3000000: |
25 |
|
26 |
class database(fs_template.FsBased): |
27 |
|
28 |
+ validation_chf = 'mtime' |
29 |
+ chf_types = ('mtime', 'md5') |
30 |
+ |
31 |
autocommits = False |
32 |
synchronous = False |
33 |
# cache_bytes is used together with page_size (set at sqlite build time) |
34 |
@@ -28,10 +31,12 @@ class database(fs_template.FsBased): |
35 |
def __init__(self, *args, **config): |
36 |
super(database, self).__init__(*args, **config) |
37 |
self._import_sqlite() |
38 |
- self._allowed_keys = ["_mtime_", "_eclasses_"] |
39 |
+ self._allowed_keys = ["_eclasses_"] |
40 |
self._allowed_keys.extend(self._known_keys) |
41 |
- self._allowed_keys.sort() |
42 |
+ self._allowed_keys.extend('_%s_' % k for k in self.chf_types) |
43 |
self._allowed_keys_set = frozenset(self._allowed_keys) |
44 |
+ self._allowed_keys = sorted(self._allowed_keys_set) |
45 |
+ |
46 |
self.location = os.path.join(self.location, |
47 |
self.label.lstrip(os.path.sep).rstrip(os.path.sep)) |