diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-11-04 01:55:32 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-11-04 01:55:32 +0000 |
commit | 42c15bf57a7ae99577a131f16e09e17a34096e97 (patch) | |
tree | 7e00705666f73f656465a99490bac57d5a486d82 | |
parent | 5c50f961c2316734e34bfefe7c9762ac89f38ff7 (diff) | |
download | portage-42c15bf57a7ae99577a131f16e09e17a34096e97.tar.gz portage-42c15bf57a7ae99577a131f16e09e17a34096e97.tar.bz2 portage-42c15bf57a7ae99577a131f16e09e17a34096e97.zip |
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.
svn path=/main/trunk/; revision=4924
-rw-r--r-- | pym/cache/util.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pym/cache/util.py b/pym/cache/util.py index f2f62991c..5dd9970b9 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): @@ -40,6 +43,19 @@ def mirror_cache(valid_nodes_iterable, src_cache, trg_cache, eclass_cache=None, except (cache_errors.CacheError, KeyError): pass + if 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) |