[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1499/8267] bitbake: cache: Don't interleave pickle cache file writing
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 1499/8267] bitbake: cache: Don't interleave pickle cache file writing
- Date: Sat, 16 Dec 2017 21:54:47 +0000 (UTC)
commit 7f6b6b2ab907cbf3c2811740bf9ad562e02dccaa
Author: Richard Purdie <richard purdie linuxfoundation org>
Date: Fri Jul 22 11:28:57 2016 +0100
bitbake: cache: Don't interleave pickle cache file writing
For some reason the data written in this way is coming back out the
files out of order. I've not been able to simplify the test case to a
point where this was standalone reproducible. Simplify the code and
write out the cache files sequentially since this seems to avoid the
errors and makes the code more readable.
(Bitbake rev: 14ec47f5f0566dbd280fae8a03160c8500ad3929)
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
bitbake/lib/bb/cache.py | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 439565f..c09f929 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -601,26 +601,19 @@ class Cache(object):
logger.debug(2, "Cache is clean, not saving.")
return
- file_dict = {}
- pickler_dict = {}
for cache_class in self.caches_array:
cache_class_name = cache_class.__name__
cachefile = getCacheFile(self.cachedir, cache_class.cachefile, self.data_hash)
- file_dict[cache_class_name] = open(cachefile, "wb")
- pickler_dict[cache_class_name] = pickle.Pickler(file_dict[cache_class_name],
pickle.HIGHEST_PROTOCOL)
- pickler_dict[cache_class_name].dump(__cache_version__)
- pickler_dict[cache_class_name].dump(bb.__version__)
-
- try:
- for key, info_array in self.depends_cache.items():
- for info in info_array:
- cache_class_name = info.__class__.__name__
- pickler_dict[cache_class_name].dump(key)
- pickler_dict[cache_class_name].dump(info)
- finally:
- for cache_class in self.caches_array:
- cache_class_name = cache_class.__name__
- file_dict[cache_class_name].close()
+ with open(cachefile, "wb") as f:
+ p = pickle.Pickler(f, pickle.HIGHEST_PROTOCOL)
+ p.dump(__cache_version__)
+ p.dump(bb.__version__)
+
+ for key, info_array in self.depends_cache.items():
+ for info in info_array:
+ if isinstance(info, RecipeInfoCommon) and info.__class__.__name__ ==
cache_class_name:
+ p.dump(key)
+ p.dump(info)
del self.depends_cache
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]