diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-09-25 23:13:52 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-09-25 23:13:52 +0000 |
commit | 1218a395d78b0085e4eb7d11fbcb20314586de9e (patch) | |
tree | 114f42c34fa91ff276b12bbea514fc13f5275569 | |
parent | 396d3b8bb373f0d9b8c0d1dcfabcd46695f72dc5 (diff) | |
download | portage-1218a395d78b0085e4eb7d11fbcb20314586de9e.tar.gz portage-1218a395d78b0085e4eb7d11fbcb20314586de9e.tar.bz2 portage-1218a395d78b0085e4eb7d11fbcb20314586de9e.zip |
Ensure that cache modules always return a dict containing the _eclasses_
key.
svn path=/main/trunk/; revision=11547
-rw-r--r-- | pym/portage/cache/flat_hash.py | 2 | ||||
-rw-r--r-- | pym/portage/cache/metadata.py | 2 | ||||
-rw-r--r-- | pym/portage/cache/sql_template.py | 4 | ||||
-rw-r--r-- | pym/portage/cache/sqlite.py | 2 | ||||
-rw-r--r-- | pym/portage/cache/template.py | 2 |
5 files changed, 12 insertions, 0 deletions
diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index ed1eebd12..40ad51eb6 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -46,6 +46,8 @@ class database(fs_template.FsBased): raise cache_errors.CacheCorruption(cpv, e) if "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"]) + else: + d["_eclasses_"] = {} return d for x in self._known_keys: diff --git a/pym/portage/cache/metadata.py b/pym/portage/cache/metadata.py index 1b06a66bd..bdd0244cb 100644 --- a/pym/portage/cache/metadata.py +++ b/pym/portage/cache/metadata.py @@ -66,6 +66,8 @@ class database(flat_hash.database): if "INHERITED" in d: d["_eclasses_"] = self.ec.get_eclass_data(d["INHERITED"].split(), from_master_only=True) del d["INHERITED"] + else: + d["_eclasses_"] = {} elif isinstance(d["_eclasses_"], basestring): # We skip this if flat_hash.database._parse_data() was called above # because it calls reconstruct_eclasses() internally. diff --git a/pym/portage/cache/sql_template.py b/pym/portage/cache/sql_template.py index 196039c74..fe873c3ea 100644 --- a/pym/portage/cache/sql_template.py +++ b/pym/portage/cache/sql_template.py @@ -238,6 +238,8 @@ class SQLDatabase(template.database): d = dict(l) if "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"]) + else: + d["_eclasses_"] = {} yield cpv, d l.clear() oldcpv = x @@ -246,6 +248,8 @@ class SQLDatabase(template.database): d = dict(l) if "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(oldcpv, d["_eclasses_"]) + else: + d["_eclasses_"] = {} yield cpv, d def commit(self): diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py index dae9d4c1d..a53e8172a 100644 --- a/pym/portage/cache/sqlite.py +++ b/pym/portage/cache/sqlite.py @@ -170,6 +170,8 @@ class database(fs_template.FsBased): pass #writemsg("%s: %s\n" % (cpv, str(e))) if "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"]) + else: + d["_eclasses_"] = {} for x in self._known_keys: d.setdefault(x,'') return d diff --git a/pym/portage/cache/template.py b/pym/portage/cache/template.py index 891a5821f..3cf8309dd 100644 --- a/pym/portage/cache/template.py +++ b/pym/portage/cache/template.py @@ -37,6 +37,8 @@ class database(object): d=self._getitem(cpv) if self.serialize_eclasses and "_eclasses_" in d: d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"]) + elif "_eclasses_" not in d: + d["_eclasses_"] = {} return d def _getitem(self, cpv): |