From 800b01b992c6112f29d058c85b019467f3bf8846 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 4 Nov 2006 05:33:36 +0000 Subject: [PATCH] When transferring cache after sync, compare all metadata to make sure it is identical (don't trust _mtime_ and _eclasses_ alone). Local tests show that this can add approximately 15% more time to the metadata update, but it's needed for things like bug #153591. (trunk r4923:4925) svn path=/main/branches/2.1.1/; revision=4930 --- pym/cache/util.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pym/cache/util.py b/pym/cache/util.py index f2f62991c..2bfaa76fb 100644 --- a/pym/cache/util.py +++ b/pym/cache/util.py @@ -3,6 +3,9 @@ # License: GPL2 # $Id$ +if not hasattr(__builtins__, "set"): + from sets import Set as set +from itertools import chain from cache import cache_errors def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, verbose_instance=None): @@ -33,6 +36,7 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, del e continue write_it = True + trg = None try: trg = trg_cache[x] if long(trg["_mtime_"]) == long(entry["_mtime_"]) and eclass_cache.is_eclass_data_valid(trg["_eclasses_"]): @@ -40,6 +44,19 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, except (cache_errors.CacheError, KeyError): pass + if trg and not write_it: + """ We don't want to skip the write unless we're really sure that + the existing cache is identical, so don't trust _mtime_ and + _eclasses_ alone.""" + for d in (entry, trg): + if "EAPI" in d and d["EAPI"] in ("", "0"): + del d["EAPI"] + for k in set(chain(entry, trg)).difference( + ("_mtime_", "_eclasses_")): + if trg.get(k, "") != entry.get(k, ""): + write_it = True + break + if write_it: try: inherited = entry.get("INHERITED", None) -- 2.26.2