Ensure that cache modules always return a dict containing the _eclasses_
authorZac Medico <zmedico@gentoo.org>
Thu, 25 Sep 2008 23:13:52 +0000 (23:13 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 25 Sep 2008 23:13:52 +0000 (23:13 -0000)
key.

svn path=/main/trunk/; revision=11547

pym/portage/cache/flat_hash.py
pym/portage/cache/metadata.py
pym/portage/cache/sql_template.py
pym/portage/cache/sqlite.py
pym/portage/cache/template.py

index ed1eebd123dd978d224dfb8e0dff79e85e9ed1b3..40ad51eb6baafcb9654f64b66830d3728e24b847 100644 (file)
@@ -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:
index 1b06a66bd69f6fcf353d64c8d2d7662426bd206a..bdd0244cb8b5113922133db993c23fccf3f97656 100644 (file)
@@ -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.
index 196039c74950cd24ca7675bff20b05aa6f7da8c6..fe873c3eab4dad2def53b3d6a4cae2b6157e2a94 100644 (file)
@@ -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):
index dae9d4c1d902b16d933030c5c506007cf754c519..a53e8172ad415b6f6c59f62e74136bf2b697bfc4 100644 (file)
@@ -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
index 891a5821f715df8e7906b2a746d628982f876c1e..3cf8309dd4a75d16ed9d439c31a5e99f6b7d8ad7 100644 (file)
@@ -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):