diff options
-rw-r--r-- | bitbake/lib/bb/cache.py | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index b90d488b99..d0fb234f89 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
@@ -290,25 +290,6 @@ class Cache(object): | |||
290 | logger.info("Out of date cache found, rebuilding...") | 290 | logger.info("Out of date cache found, rebuilding...") |
291 | 291 | ||
292 | def load_cachefile(self): | 292 | def load_cachefile(self): |
293 | # Firstly, using core cache file information for | ||
294 | # valid checking | ||
295 | with open(self.cachefile, "rb") as cachefile: | ||
296 | pickled = pickle.Unpickler(cachefile) | ||
297 | try: | ||
298 | cache_ver = pickled.load() | ||
299 | bitbake_ver = pickled.load() | ||
300 | except Exception: | ||
301 | logger.info('Invalid cache, rebuilding...') | ||
302 | return | ||
303 | |||
304 | if cache_ver != __cache_version__: | ||
305 | logger.info('Cache version mismatch, rebuilding...') | ||
306 | return | ||
307 | elif bitbake_ver != bb.__version__: | ||
308 | logger.info('Bitbake version mismatch, rebuilding...') | ||
309 | return | ||
310 | |||
311 | |||
312 | cachesize = 0 | 293 | cachesize = 0 |
313 | previous_progress = 0 | 294 | previous_progress = 0 |
314 | previous_percent = 0 | 295 | previous_percent = 0 |
@@ -326,7 +307,24 @@ class Cache(object): | |||
326 | if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon): | 307 | if type(cache_class) is type and issubclass(cache_class, RecipeInfoCommon): |
327 | cachefile = getCacheFile(self.cachedir, cache_class.cachefile, self.data_hash) | 308 | cachefile = getCacheFile(self.cachedir, cache_class.cachefile, self.data_hash) |
328 | with open(cachefile, "rb") as cachefile: | 309 | with open(cachefile, "rb") as cachefile: |
329 | pickled = pickle.Unpickler(cachefile) | 310 | pickled = pickle.Unpickler(cachefile) |
311 | # Check cache version information | ||
312 | try: | ||
313 | cache_ver = pickled.load() | ||
314 | bitbake_ver = pickled.load() | ||
315 | except Exception: | ||
316 | logger.info('Invalid cache, rebuilding...') | ||
317 | return | ||
318 | |||
319 | if cache_ver != __cache_version__: | ||
320 | logger.info('Cache version mismatch, rebuilding...') | ||
321 | return | ||
322 | elif bitbake_ver != bb.__version__: | ||
323 | logger.info('Bitbake version mismatch, rebuilding...') | ||
324 | return | ||
325 | |||
326 | # Load the rest of the cache file | ||
327 | current_progress = 0 | ||
330 | while cachefile: | 328 | while cachefile: |
331 | try: | 329 | try: |
332 | key = pickled.load() | 330 | key = pickled.load() |
@@ -608,9 +606,8 @@ class Cache(object): | |||
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 | file_dict[cache_class_name] = open(cachefile, "wb") |
610 | pickler_dict[cache_class_name] = pickle.Pickler(file_dict[cache_class_name], pickle.HIGHEST_PROTOCOL) | 608 | pickler_dict[cache_class_name] = pickle.Pickler(file_dict[cache_class_name], pickle.HIGHEST_PROTOCOL) |
611 | 609 | pickler_dict[cache_class_name].dump(__cache_version__) | |
612 | pickler_dict['CoreRecipeInfo'].dump(__cache_version__) | 610 | pickler_dict[cache_class_name].dump(bb.__version__) |
613 | pickler_dict['CoreRecipeInfo'].dump(bb.__version__) | ||
614 | 611 | ||
615 | try: | 612 | try: |
616 | for key, info_array in self.depends_cache.items(): | 613 | for key, info_array in self.depends_cache.items(): |