summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
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
parent9ffbd9fe27e25a458b09631c503f4ef96632e334 (diff)
downloadopenembedded-core-95d2f56126d459b9e7f000d22ed7c1206d1a8f68.tar.gz
openembedded-core-95d2f56126d459b9e7f000d22ed7c1206d1a8f68.tar.bz2
openembedded-core-95d2f56126d459b9e7f000d22ed7c1206d1a8f68.tar.xz
openembedded-core-95d2f56126d459b9e7f000d22ed7c1206d1a8f68.zip
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')
-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 93dccf21f..3edd80ec3 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -402,22 +402,15 @@ class Cache(object):
logger.debug(2, "Cache is clean, not saving.")
return
- version_data = {}
- version_data['CACHE_VER'] = __cache_version__
- version_data['BITBAKE_VER'] = bb.__version__
-
- cache_data = dict(self.depends_cache)
- for fn, info in self.depends_cache.iteritems():
- if info.nocache:
- logger.debug(2, "Not caching %s, marked as not cacheable", fn)
- del cache_data[fn]
- elif info.pv and 'SRCREVINACTION' in info.pv:
- logger.error("Not caching %s as it had SRCREVINACTION in PV. "
- "Please report this bug", fn)
- del cache_data[fn]
-
- p = pickle.Pickler(file(self.cachefile, "wb"), -1)
- p.dump([cache_data, version_data])
+ version_data = {
+ 'CACHE_VER': __cache_version__,
+ 'BITBAKE_VER': bb.__version__,
+ }
+
+ with open(self.cachefile, "wb") as cachefile:
+ pickle.Pickler(cachefile, -1).dump([self.depends_cache,
+ version_data])
+
del self.depends_cache
@staticmethod
@@ -425,13 +418,11 @@ class Cache(object):
return bb.parse.cached_mtime_noerror(cachefile)
def add_info(self, filename, info, cacheData, parsed=None):
- self.depends_cache[filename] = info
cacheData.add_from_recipeinfo(filename, info)
- if parsed and not info.nocache:
- # The recipe was parsed, and is not marked as being
- # uncacheable, so we need to ensure that we write out the
- # new cache data.
- self.cacheclean = False
+ if 'SRCREVINACTION' not in info.pv and not info.nocache:
+ if parsed:
+ self.cacheclean = False
+ self.depends_cache[filename] = info
def add(self, file_name, data, cacheData, parsed=None):
"""