diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-04 01:05:06 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-04 01:05:06 +0000 |
commit | 7beab48ded7c7a6ce3cb6479bb7e9c86bde84140 (patch) | |
tree | b78ace3cae8e8f89820247f21ae67b4b8c366b30 /bin | |
parent | 1f8a8caa4aefa2f2ec475e2f5e2f1585419b98b6 (diff) | |
download | portage-7beab48ded7c7a6ce3cb6479bb7e9c86bde84140.tar.gz portage-7beab48ded7c7a6ce3cb6479bb7e9c86bde84140.tar.bz2 portage-7beab48ded7c7a6ce3cb6479bb7e9c86bde84140.zip |
In BlockerData._load(), salvage as much cache as possible when some
seems to be corrupt. (trunk r10149)
svn path=/main/branches/2.1.2/; revision=10150
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/emerge | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/bin/emerge b/bin/emerge index 960502e9a..92e321021 100755 --- a/bin/emerge +++ b/bin/emerge @@ -1536,37 +1536,48 @@ class BlockerCache(DictMixin): if cache_valid: # Validate all the atoms and counters so that # corruption is detected as soon as possible. + invalid_items = set() for k, v in self._cache_data["blockers"].iteritems(): if not isinstance(k, basestring): - cache_valid = False - break + invalid_items.add(k) + continue try: - portage.catpkgsplit(k) + if portage.catpkgsplit(k) is None: + invalid_items.add(k) + continue except portage_exception.InvalidData: - cache_valid = False - break + invalid_items.add(k) + continue if not isinstance(v, tuple) or \ len(v) != 2: - cache_valid = False - break + invalid_items.add(k) + continue counter, atoms = v if not isinstance(counter, (int, long)): - cache_valid = False - break + invalid_items.add(k) + continue if not isinstance(atoms, list): - cache_valid = False - break + invalid_items.add(k) + continue + invalid_atom = False for atom in atoms: if not isinstance(atom, basestring): - cache_valid = False + invalid_atom = True break if atom[:1] != "!" or \ not portage.isvalidatom( atom, allow_blockers=True): - cache_valid = False + invalid_atom = True break - if not cache_valid: - break + if invalid_atom: + invalid_items.add(k) + continue + + for k in invalid_items: + del self._cache_data["blockers"][k] + if not self._cache_data["blockers"]: + cache_valid = False + if not cache_valid: self._cache_data = {"version":self._cache_version} self._cache_data["blockers"] = {} |