1 |
commit: 687dbcb0ab2f7d254bdc53b1332b3d480b2de581 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 2 20:51:15 2020 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 2 21:04:37 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=687dbcb0 |
7 |
|
8 |
anydbm: avoid interference between cleanse_keys and _eclasses_ |
9 |
|
10 |
Fix this AuxdbTestCase failure for anydbm: |
11 |
|
12 |
test_anydbm (portage.tests.dbapi.test_auxdb.AuxdbTestCase) ... Exception in callback None() |
13 |
handle: <Handle cancelled> |
14 |
Traceback (most recent call last): |
15 |
File "/usr/lib64/python3.6/asyncio/events.py", line 145, in _run |
16 |
self._callback(*self._args) |
17 |
File "lib/_emerge/EbuildMetadataPhase.py", line 143, in _output_handler |
18 |
self._async_waitpid() |
19 |
File "lib/_emerge/SubProcess.py", line 60, in _async_waitpid |
20 |
add_child_handler(self.pid, self._async_waitpid_cb) |
21 |
File "/usr/lib64/python3.6/asyncio/unix_events.py", line 873, in add_child_handler |
22 |
self._do_waitpid(pid) |
23 |
File "/usr/lib64/python3.6/asyncio/unix_events.py", line 919, in _do_waitpid |
24 |
callback(pid, returncode, *args) |
25 |
File "lib/_emerge/EbuildMetadataPhase.py", line 207, in _async_waitpid_cb |
26 |
self.repo_path, metadata, self.ebuild_hash) |
27 |
File "lib/portage/dbapi/porttree.py", line 545, in _write_cache |
28 |
cache[cpv] = metadata |
29 |
File "lib/portage/cache/template.py", line 146, in __setitem__ |
30 |
d["_eclasses_"] = self._internal_eclasses(d["_eclasses_"], |
31 |
File "lib/portage/cache/mappings.py", line 213, in __getitem__ |
32 |
raise KeyError(key) |
33 |
KeyError: '_eclasses_' |
34 |
|
35 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
36 |
|
37 |
lib/portage/cache/template.py | 2 +- |
38 |
lib/portage/tests/dbapi/test_auxdb.py | 7 +++++++ |
39 |
2 files changed, 8 insertions(+), 1 deletion(-) |
40 |
|
41 |
diff --git a/lib/portage/cache/template.py b/lib/portage/cache/template.py |
42 |
index 8662d859f..6b4878347 100644 |
43 |
--- a/lib/portage/cache/template.py |
44 |
+++ b/lib/portage/cache/template.py |
45 |
@@ -133,7 +133,7 @@ class database(object): |
46 |
d = None |
47 |
if self.cleanse_keys: |
48 |
d=ProtectedDict(values) |
49 |
- for k, v in list(d.items()): |
50 |
+ for k, v in list(item for item in d.items() if item[0] != "_eclasses_"): |
51 |
if not v: |
52 |
del d[k] |
53 |
if "_eclasses_" in values: |
54 |
|
55 |
diff --git a/lib/portage/tests/dbapi/test_auxdb.py b/lib/portage/tests/dbapi/test_auxdb.py |
56 |
index 73fc2b2c3..cfcabc8bb 100644 |
57 |
--- a/lib/portage/tests/dbapi/test_auxdb.py |
58 |
+++ b/lib/portage/tests/dbapi/test_auxdb.py |
59 |
@@ -11,6 +11,13 @@ from portage.util.futures.compat_coroutine import coroutine |
60 |
|
61 |
class AuxdbTestCase(TestCase): |
62 |
|
63 |
+ def test_anydbm(self): |
64 |
+ try: |
65 |
+ from portage.cache.anydbm import database |
66 |
+ except ImportError: |
67 |
+ self.skipTest('dbm import failed') |
68 |
+ self._test_mod('portage.cache.anydbm.database') |
69 |
+ |
70 |
def test_flat_hash_md5(self): |
71 |
self._test_mod('portage.cache.flat_hash.md5_database') |