From 0c1bbb316ce2e7e9608af78f5e2f5dea1c667af7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 14 Oct 2011 23:11:02 -0700 Subject: [PATCH] emerge --metadata: fix empty INHERITED handling 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 | 6 +++--- pym/portage/eclass_cache.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 71a090233..087951016 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -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: diff --git a/pym/portage/eclass_cache.py b/pym/portage/eclass_cache.py index 2f6e94770..808662bd5 100644 --- a/pym/portage/eclass_cache.py +++ b/pym/portage/eclass_cache.py @@ -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) -- 2.26.2