cache/template.__getitem__: filter INHERITED
authorZac Medico <zmedico@gentoo.org>
Sat, 29 Oct 2011 23:10:13 +0000 (16:10 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 29 Oct 2011 23:10:13 +0000 (16:10 -0700)
Never return INHERITED, since portdbapi.aux_get() will generate it
automatically from _eclasses_, and we want to omit it in comparisons
between cache entries like those that egencache uses to avoid redundant
writes (see commit 0e120da008c9d0d41c9372c81145c6e153028a6d).

pym/portage/cache/metadata.py
pym/portage/cache/template.py

index 07ec20ebc78378272973e465ddcc5510cd8474b9..9d2c3a5d78ff423c432bd88633e2ecb2a6517a9d 100644 (file)
@@ -72,7 +72,6 @@ class database(flat_hash.database):
                                except KeyError as e:
                                        # INHERITED contains a non-existent eclass.
                                        raise cache_errors.CacheCorruption(cpv, e)
-                               del d["INHERITED"]
                        else:
                                d["_eclasses_"] = {}
                elif isinstance(d["_eclasses_"], basestring):
index 515ba022b30150c901cbfb95dd251a8d5eb4b075..0af6c20cad361a7fadb96a117f03e89d5d5b1213 100644 (file)
@@ -47,6 +47,11 @@ class database(object):
                                self.validation_chf, paths=self.store_eclass_paths)
                elif "_eclasses_" not in d:
                        d["_eclasses_"] = {}
+               # Never return INHERITED, since portdbapi.aux_get() will
+               # generate it automatically from _eclasses_, and we want
+               # to omit it in comparisons between cache entries like
+               # those that egencache uses to avoid redundant writes.
+               d.pop("INHERITED", None)
                mtime = d.get('_mtime_')
                if mtime is None:
                        raise cache_errors.CacheCorruption(cpv,