1 |
Author: zmedico |
2 |
Date: 2008-05-04 01:05:06 +0000 (Sun, 04 May 2008) |
3 |
New Revision: 10150 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/emerge |
7 |
Log: |
8 |
In BlockerData._load(), salvage as much cache as possible when some |
9 |
seems to be corrupt. (trunk r10149) |
10 |
|
11 |
|
12 |
Modified: main/branches/2.1.2/bin/emerge |
13 |
=================================================================== |
14 |
--- main/branches/2.1.2/bin/emerge 2008-05-04 01:04:44 UTC (rev 10149) |
15 |
+++ main/branches/2.1.2/bin/emerge 2008-05-04 01:05:06 UTC (rev 10150) |
16 |
@@ -1536,37 +1536,48 @@ |
17 |
if cache_valid: |
18 |
# Validate all the atoms and counters so that |
19 |
# corruption is detected as soon as possible. |
20 |
+ invalid_items = set() |
21 |
for k, v in self._cache_data["blockers"].iteritems(): |
22 |
if not isinstance(k, basestring): |
23 |
- cache_valid = False |
24 |
- break |
25 |
+ invalid_items.add(k) |
26 |
+ continue |
27 |
try: |
28 |
- portage.catpkgsplit(k) |
29 |
+ if portage.catpkgsplit(k) is None: |
30 |
+ invalid_items.add(k) |
31 |
+ continue |
32 |
except portage_exception.InvalidData: |
33 |
- cache_valid = False |
34 |
- break |
35 |
+ invalid_items.add(k) |
36 |
+ continue |
37 |
if not isinstance(v, tuple) or \ |
38 |
len(v) != 2: |
39 |
- cache_valid = False |
40 |
- break |
41 |
+ invalid_items.add(k) |
42 |
+ continue |
43 |
counter, atoms = v |
44 |
if not isinstance(counter, (int, long)): |
45 |
- cache_valid = False |
46 |
- break |
47 |
+ invalid_items.add(k) |
48 |
+ continue |
49 |
if not isinstance(atoms, list): |
50 |
- cache_valid = False |
51 |
- break |
52 |
+ invalid_items.add(k) |
53 |
+ continue |
54 |
+ invalid_atom = False |
55 |
for atom in atoms: |
56 |
if not isinstance(atom, basestring): |
57 |
- cache_valid = False |
58 |
+ invalid_atom = True |
59 |
break |
60 |
if atom[:1] != "!" or \ |
61 |
not portage.isvalidatom( |
62 |
atom, allow_blockers=True): |
63 |
- cache_valid = False |
64 |
+ invalid_atom = True |
65 |
break |
66 |
- if not cache_valid: |
67 |
- break |
68 |
+ if invalid_atom: |
69 |
+ invalid_items.add(k) |
70 |
+ continue |
71 |
+ |
72 |
+ for k in invalid_items: |
73 |
+ del self._cache_data["blockers"][k] |
74 |
+ if not self._cache_data["blockers"]: |
75 |
+ cache_valid = False |
76 |
+ |
77 |
if not cache_valid: |
78 |
self._cache_data = {"version":self._cache_version} |
79 |
self._cache_data["blockers"] = {} |
80 |
|
81 |
-- |
82 |
gentoo-commits@l.g.o mailing list |