From: Zac Medico Date: Thu, 25 Sep 2008 23:13:52 +0000 (-0000) Subject: Ensure that cache modules always return a dict containing the _eclasses_ X-Git-Tag: v2.2_rc10~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1218a395d78b0085e4eb7d11fbcb20314586de9e;p=portage.git Ensure that cache modules always return a dict containing the _eclasses_ key. svn path=/main/trunk/; revision=11547 --- 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):