emerge --metadata: fix empty INHERITED handling
authorZac Medico <zmedico@gentoo.org>
Sat, 15 Oct 2011 06:11:02 +0000 (23:11 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 15 Oct 2011 06:11:02 +0000 (23:11 -0700)
Since changes to eclass validation code in commit
2ed1cb53cc4158af08c22d466b15b9a9a7767212, validation of cache for
packages with empty INHERITED metadata has been broken due to failure
to distinguish between None and empty dict return values from
eclass.cache.validate_and_rewrite_cache().

pym/_emerge/actions.py
pym/portage/eclass_cache.py

index 71a09023321a3ca9e12a16835ae0de901b2c8435..087951016c165803cef97360dbdae463bdbe63be 100644 (file)
@@ -1743,7 +1743,7 @@ def action_metadata(settings, portdb, myopts, porttrees=None):
                                        if not (dest['_mtime_'] == src['_mtime_'] and \
                                                tree_data.eclass_db.validate_and_rewrite_cache(
                                                        dest['_eclasses_'], tree_data.dest_db.validation_chf,
-                                                       tree_data.dest_db.store_eclass_paths) and \
+                                                       tree_data.dest_db.store_eclass_paths) is not None and \
                                                set(dest['_eclasses_']) == set(src['_eclasses_'])):
                                                dest = None
                                        else:
@@ -1768,9 +1768,9 @@ def action_metadata(settings, portdb, myopts, porttrees=None):
                                        continue
 
                                if eclasses is not None:
-                                       if not tree_data.eclass_db.validate_and_rewrite_cache(
+                                       if tree_data.eclass_db.validate_and_rewrite_cache(
                                                src['_eclasses_'], tree_data.src_db.validation_chf,
-                                               tree_data.src_db.store_eclass_paths):
+                                               tree_data.src_db.store_eclass_paths) is None:
                                                continue
                                        inherited = eclasses
                                else:
index 2f6e947700a8e26fd424c4e9f8a1c173204f9752..808662bd518eaab2385c183fa3b46f145c94b051 100644 (file)
@@ -133,6 +133,11 @@ class cache(object):
                                self._eclass_locations[ys] = x
 
        def validate_and_rewrite_cache(self, ec_dict, chf_type, stores_paths):
+               """
+               This will return an empty dict if the ec_dict parameter happens
+               to be empty, therefore callers must take care to distinguish
+               between empty dict and None return values.
+               """
                if not isinstance(ec_dict, dict):
                        return None
                our_getter = operator.attrgetter(chf_type)