summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cache.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-05-23 00:23:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-23 11:35:04 +0100
commit8b8be74ed21b878b2fe30d5b76ff0648e6e48c18 (patch)
treef1facae6d6803b450185811ca08bf215d6963530 /bitbake/lib/bb/cache.py
parentd7b818b51f3e6dded0c0885cdfed5a24cda3b428 (diff)
downloadpoky-8b8be74ed21b878b2fe30d5b76ff0648e6e48c18.tar.gz
bitbake: implement checksums for local files in SRC_URI
Gathers a list of paths to have checksums calculated at parse time, and processes these when calculating task hashes. Checksums are cached with the file's current mtime. Thus, changing any local file in SRC_URI will now cause the do_fetch taskhash to change, thus forcing a rebuild. This change adds very roughly about an 8% increase in parse time (a few seconds) and maybe a few seconds during runqueue generation, so a fairly moderate performance hit. Note that since paths are resolved at parse time, this will not force a rebuild when files are introduced which would cause that resolved path to be different - for example, where a machine-specific version of a file was added without otherwise changing the recipe. This will need to be handled in a future update. Code to hook this into the signature generator was courtesy of Richard Purdie <richard.purdie@linuxfoundation.org>. Implements [YOCTO #2044]. (Bitbake rev: c993b7c457f8b7776e8a5dff253bfa0724bc2cae) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r--bitbake/lib/bb/cache.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 36e6356f51..dea2a80616 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -43,7 +43,7 @@ except ImportError:
43 logger.info("Importing cPickle failed. " 43 logger.info("Importing cPickle failed. "
44 "Falling back to a very slow implementation.") 44 "Falling back to a very slow implementation.")
45 45
46__cache_version__ = "143" 46__cache_version__ = "144"
47 47
48def getCacheFile(path, filename, data_hash): 48def getCacheFile(path, filename, data_hash):
49 return os.path.join(path, filename + "." + data_hash) 49 return os.path.join(path, filename + "." + data_hash)
@@ -76,9 +76,13 @@ class RecipeInfoCommon(object):
76 for task in tasks) 76 for task in tasks)
77 77
78 @classmethod 78 @classmethod
79 def flaglist(cls, flag, varlist, metadata): 79 def flaglist(cls, flag, varlist, metadata, squash=False):
80 return dict((var, metadata.getVarFlag(var, flag, True)) 80 out_dict = dict((var, metadata.getVarFlag(var, flag, True))
81 for var in varlist) 81 for var in varlist)
82 if squash:
83 return dict((k,v) for (k,v) in out_dict.iteritems() if v)
84 else:
85 return out_dict
82 86
83 @classmethod 87 @classmethod
84 def getvar(cls, var, metadata): 88 def getvar(cls, var, metadata):
@@ -128,6 +132,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
128 self.stamp = self.getvar('STAMP', metadata) 132 self.stamp = self.getvar('STAMP', metadata)
129 self.stamp_base = self.flaglist('stamp-base', self.tasks, metadata) 133 self.stamp_base = self.flaglist('stamp-base', self.tasks, metadata)
130 self.stamp_extrainfo = self.flaglist('stamp-extra-info', self.tasks, metadata) 134 self.stamp_extrainfo = self.flaglist('stamp-extra-info', self.tasks, metadata)
135 self.file_checksums = self.flaglist('file-checksums', self.tasks, metadata, True)
131 self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata) 136 self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata)
132 self.depends = self.depvar('DEPENDS', metadata) 137 self.depends = self.depvar('DEPENDS', metadata)
133 self.provides = self.depvar('PROVIDES', metadata) 138 self.provides = self.depvar('PROVIDES', metadata)
@@ -154,6 +159,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
154 cachedata.stamp = {} 159 cachedata.stamp = {}
155 cachedata.stamp_base = {} 160 cachedata.stamp_base = {}
156 cachedata.stamp_extrainfo = {} 161 cachedata.stamp_extrainfo = {}
162 cachedata.file_checksums = {}
157 cachedata.fn_provides = {} 163 cachedata.fn_provides = {}
158 cachedata.pn_provides = defaultdict(list) 164 cachedata.pn_provides = defaultdict(list)
159 cachedata.all_depends = [] 165 cachedata.all_depends = []
@@ -185,6 +191,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
185 cachedata.stamp[fn] = self.stamp 191 cachedata.stamp[fn] = self.stamp
186 cachedata.stamp_base[fn] = self.stamp_base 192 cachedata.stamp_base[fn] = self.stamp_base
187 cachedata.stamp_extrainfo[fn] = self.stamp_extrainfo 193 cachedata.stamp_extrainfo[fn] = self.stamp_extrainfo
194 cachedata.file_checksums[fn] = self.file_checksums
188 195
189 provides = [self.pn] 196 provides = [self.pn]
190 for provide in self.provides: 197 for provide in self.provides: