diff options
Diffstat (limited to 'bitbake')
| -rw-r--r-- | 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 439565f5a6..c09f9296bd 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
| @@ -601,26 +601,19 @@ class Cache(object): | |||
| 601 | logger.debug(2, "Cache is clean, not saving.") | 601 | logger.debug(2, "Cache is clean, not saving.") |
| 602 | return | 602 | return |
| 603 | 603 | ||
| 604 | file_dict = {} | ||
| 605 | pickler_dict = {} | ||
| 606 | for cache_class in self.caches_array: | 604 | for cache_class in self.caches_array: |
| 607 | cache_class_name = cache_class.__name__ | 605 | cache_class_name = cache_class.__name__ |
| 608 | cachefile = getCacheFile(self.cachedir, cache_class.cachefile, self.data_hash) | 606 | cachefile = getCacheFile(self.cachedir, cache_class.cachefile, self.data_hash) |
| 609 | file_dict[cache_class_name] = open(cachefile, "wb") | 607 | with open(cachefile, "wb") as f: |
| 610 | pickler_dict[cache_class_name] = pickle.Pickler(file_dict[cache_class_name], pickle.HIGHEST_PROTOCOL) | 608 | p = pickle.Pickler(f, pickle.HIGHEST_PROTOCOL) |
| 611 | pickler_dict[cache_class_name].dump(__cache_version__) | 609 | p.dump(__cache_version__) |
| 612 | pickler_dict[cache_class_name].dump(bb.__version__) | 610 | p.dump(bb.__version__) |
| 613 | 611 | ||
| 614 | try: | 612 | for key, info_array in self.depends_cache.items(): |
| 615 | for key, info_array in self.depends_cache.items(): | 613 | for info in info_array: |
| 616 | for info in info_array: | 614 | if isinstance(info, RecipeInfoCommon) and info.__class__.__name__ == cache_class_name: |
| 617 | cache_class_name = info.__class__.__name__ | 615 | p.dump(key) |
| 618 | pickler_dict[cache_class_name].dump(key) | 616 | p.dump(info) |
| 619 | pickler_dict[cache_class_name].dump(info) | ||
| 620 | finally: | ||
| 621 | for cache_class in self.caches_array: | ||
| 622 | cache_class_name = cache_class.__name__ | ||
| 623 | file_dict[cache_class_name].close() | ||
| 624 | 617 | ||
| 625 | del self.depends_cache | 618 | del self.depends_cache |
| 626 | 619 | ||
