summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cache.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-11-18 22:28:09 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:43 +0000
commit95d2f56126d459b9e7f000d22ed7c1206d1a8f68 (patch)
treecf0ee27eb9587df80c2ba93221a58887d278ce08 /bitbake/lib/bb/cache.py
parent9ffbd9fe27e25a458b09631c503f4ef96632e334 (diff)
downloadpoky-95d2f56126d459b9e7f000d22ed7c1206d1a8f68.tar.gz
Simplify cache syncing
Rather than adding nocache items to the cache, then copying the cache and removing them to sync it, don't add them in the first place. Also use 'with' for the cachefile. (Bitbake rev: 343b6f6255ad020c39e30742175a241f0859a5a6) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r--bitbake/lib/bb/cache.py35
1 files changed, 13 insertions, 22 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 93dccf21f1..3edd80ec3b 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -402,22 +402,15 @@ class Cache(object):
402 logger.debug(2, "Cache is clean, not saving.") 402 logger.debug(2, "Cache is clean, not saving.")
403 return 403 return
404 404
405 version_data = {} 405 version_data = {
406 version_data['CACHE_VER'] = __cache_version__ 406 'CACHE_VER': __cache_version__,
407 version_data['BITBAKE_VER'] = bb.__version__ 407 'BITBAKE_VER': bb.__version__,
408 408 }
409 cache_data = dict(self.depends_cache) 409
410 for fn, info in self.depends_cache.iteritems(): 410 with open(self.cachefile, "wb") as cachefile:
411 if info.nocache: 411 pickle.Pickler(cachefile, -1).dump([self.depends_cache,
412 logger.debug(2, "Not caching %s, marked as not cacheable", fn) 412 version_data])
413 del cache_data[fn] 413
414 elif info.pv and 'SRCREVINACTION' in info.pv:
415 logger.error("Not caching %s as it had SRCREVINACTION in PV. "
416 "Please report this bug", fn)
417 del cache_data[fn]
418
419 p = pickle.Pickler(file(self.cachefile, "wb"), -1)
420 p.dump([cache_data, version_data])
421 del self.depends_cache 414 del self.depends_cache
422 415
423 @staticmethod 416 @staticmethod
@@ -425,13 +418,11 @@ class Cache(object):
425 return bb.parse.cached_mtime_noerror(cachefile) 418 return bb.parse.cached_mtime_noerror(cachefile)
426 419
427 def add_info(self, filename, info, cacheData, parsed=None): 420 def add_info(self, filename, info, cacheData, parsed=None):
428 self.depends_cache[filename] = info
429 cacheData.add_from_recipeinfo(filename, info) 421 cacheData.add_from_recipeinfo(filename, info)
430 if parsed and not info.nocache: 422 if 'SRCREVINACTION' not in info.pv and not info.nocache:
431 # The recipe was parsed, and is not marked as being 423 if parsed:
432 # uncacheable, so we need to ensure that we write out the 424 self.cacheclean = False
433 # new cache data. 425 self.depends_cache[filename] = info
434 self.cacheclean = False
435 426
436 def add(self, file_name, data, cacheData, parsed=None): 427 def add(self, file_name, data, cacheData, parsed=None):
437 """ 428 """