summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-18 11:32:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-20 11:48:38 +0100
commitd485d0b0e875c9f5161645647472ce72af8d322e (patch)
tree511c662104813c268361f808de5e13756b0574ed /bitbake/lib
parenta4fd77db84c86b6953ddf48acb0dbba7508a2ac4 (diff)
downloadpoky-d485d0b0e875c9f5161645647472ce72af8d322e.tar.gz
bitbake: build/siggen: Add support for stamp 'clean' masks
Currently when we execute a task, we don't remove other potentially stale stamps. This can mean if you switch between two different versions of a recipe without a clean, the build can get very confused. This patch adds in functionality to allow a wildcard expression of stamp files to be removed when creating a new stamp file. This patch adds in the core of the code to enable this but it also requires metadata support to enable it. When writing this improvement I went through several different options but this was the only way I could find to allow things like noexec tasks to function correctly (where stamps need to be created without the data store). [YOCTO #2961] (Bitbake rev: e026469b307522e5b6a680e0ae5587749d33dcae) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/build.py29
-rw-r--r--bitbake/lib/bb/cache.py8
-rw-r--r--bitbake/lib/bb/siggen.py13
3 files changed, 47 insertions, 3 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 82d22f7165..85af42c684 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -470,11 +470,40 @@ def stamp_internal(taskname, d, file_name):
470 470
471 return stamp 471 return stamp
472 472
473def stamp_cleanmask_internal(taskname, d, file_name):
474 """
475 Internal stamp helper function to generate stamp cleaning mask
476 Returns the stamp path+filename
477
478 In the bitbake core, d can be a CacheData and file_name will be set.
479 When called in task context, d will be a data store, file_name will not be set
480 """
481 taskflagname = taskname
482 if taskname.endswith("_setscene") and taskname != "do_setscene":
483 taskflagname = taskname.replace("_setscene", "")
484
485 if file_name:
486 stamp = d.stamp_base_clean[file_name].get(taskflagname) or d.stampclean[file_name]
487 extrainfo = d.stamp_extrainfo[file_name].get(taskflagname) or ""
488 else:
489 stamp = d.getVarFlag(taskflagname, 'stamp-base-clean', True) or d.getVar('STAMPCLEAN', True)
490 file_name = d.getVar('BB_FILENAME', True)
491 extrainfo = d.getVarFlag(taskflagname, 'stamp-extra-info', True) or ""
492
493 if not stamp:
494 return
495
496 return bb.parse.siggen.stampcleanmask(stamp, file_name, taskname, extrainfo)
497
473def make_stamp(task, d, file_name = None): 498def make_stamp(task, d, file_name = None):
474 """ 499 """
475 Creates/updates a stamp for a given task 500 Creates/updates a stamp for a given task
476 (d can be a data dict or dataCache) 501 (d can be a data dict or dataCache)
477 """ 502 """
503 cleanmask = stamp_cleanmask_internal(task, d, file_name)
504 if cleanmask:
505 bb.utils.remove(cleanmask)
506
478 stamp = stamp_internal(task, d, file_name) 507 stamp = stamp_internal(task, d, file_name)
479 # Remove the file and recreate to force timestamp 508 # Remove the file and recreate to force timestamp
480 # change on broken NFS filesystems 509 # change on broken NFS filesystems
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index dea2a80616..619b9eec24 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__ = "144" 46__cache_version__ = "145"
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)
@@ -130,7 +130,9 @@ class CoreRecipeInfo(RecipeInfoCommon):
130 self.broken = self.getvar('BROKEN', metadata) 130 self.broken = self.getvar('BROKEN', metadata)
131 self.not_world = self.getvar('EXCLUDE_FROM_WORLD', metadata) 131 self.not_world = self.getvar('EXCLUDE_FROM_WORLD', metadata)
132 self.stamp = self.getvar('STAMP', metadata) 132 self.stamp = self.getvar('STAMP', metadata)
133 self.stampclean = self.getvar('STAMPCLEAN', metadata)
133 self.stamp_base = self.flaglist('stamp-base', self.tasks, metadata) 134 self.stamp_base = self.flaglist('stamp-base', self.tasks, metadata)
135 self.stamp_base_clean = self.flaglist('stamp-base-clean', self.tasks, metadata)
134 self.stamp_extrainfo = self.flaglist('stamp-extra-info', self.tasks, metadata) 136 self.stamp_extrainfo = self.flaglist('stamp-extra-info', self.tasks, metadata)
135 self.file_checksums = self.flaglist('file-checksums', self.tasks, metadata, True) 137 self.file_checksums = self.flaglist('file-checksums', self.tasks, metadata, True)
136 self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata) 138 self.packages_dynamic = self.listvar('PACKAGES_DYNAMIC', metadata)
@@ -157,7 +159,9 @@ class CoreRecipeInfo(RecipeInfoCommon):
157 cachedata.pkg_dp = {} 159 cachedata.pkg_dp = {}
158 160
159 cachedata.stamp = {} 161 cachedata.stamp = {}
162 cachedata.stampclean = {}
160 cachedata.stamp_base = {} 163 cachedata.stamp_base = {}
164 cachedata.stamp_base_clean = {}
161 cachedata.stamp_extrainfo = {} 165 cachedata.stamp_extrainfo = {}
162 cachedata.file_checksums = {} 166 cachedata.file_checksums = {}
163 cachedata.fn_provides = {} 167 cachedata.fn_provides = {}
@@ -189,7 +193,9 @@ class CoreRecipeInfo(RecipeInfoCommon):
189 cachedata.pkg_pepvpr[fn] = (self.pe, self.pv, self.pr) 193 cachedata.pkg_pepvpr[fn] = (self.pe, self.pv, self.pr)
190 cachedata.pkg_dp[fn] = self.defaultpref 194 cachedata.pkg_dp[fn] = self.defaultpref
191 cachedata.stamp[fn] = self.stamp 195 cachedata.stamp[fn] = self.stamp
196 cachedata.stampclean[fn] = self.stampclean
192 cachedata.stamp_base[fn] = self.stamp_base 197 cachedata.stamp_base[fn] = self.stamp_base
198 cachedata.stamp_base_clean[fn] = self.stamp_base_clean
193 cachedata.stamp_extrainfo[fn] = self.stamp_extrainfo 199 cachedata.stamp_extrainfo[fn] = self.stamp_extrainfo
194 cachedata.file_checksums[fn] = self.file_checksums 200 cachedata.file_checksums[fn] = self.file_checksums
195 201
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index 8fe59b9057..ff70d4ff4f 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -48,6 +48,9 @@ class SignatureGenerator(object):
48 def stampfile(self, stampbase, file_name, taskname, extrainfo): 48 def stampfile(self, stampbase, file_name, taskname, extrainfo):
49 return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') 49 return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.')
50 50
51 def stampcleanmask(self, stampbase, file_name, taskname, extrainfo):
52 return ("%s.%s*.%s" % (stampbase, taskname, extrainfo)).rstrip('.')
53
51 def dump_sigtask(self, fn, task, stampbase, runtime): 54 def dump_sigtask(self, fn, task, stampbase, runtime):
52 return 55 return
53 56
@@ -266,18 +269,24 @@ class SignatureGeneratorBasic(SignatureGenerator):
266class SignatureGeneratorBasicHash(SignatureGeneratorBasic): 269class SignatureGeneratorBasicHash(SignatureGeneratorBasic):
267 name = "basichash" 270 name = "basichash"
268 271
269 def stampfile(self, stampbase, fn, taskname, extrainfo): 272 def stampfile(self, stampbase, fn, taskname, extrainfo, clean=False):
270 if taskname != "do_setscene" and taskname.endswith("_setscene"): 273 if taskname != "do_setscene" and taskname.endswith("_setscene"):
271 k = fn + "." + taskname[:-9] 274 k = fn + "." + taskname[:-9]
272 else: 275 else:
273 k = fn + "." + taskname 276 k = fn + "." + taskname
274 if k in self.taskhash: 277 if clean:
278 h = "*"
279 taskname = taskname + "*"
280 elif k in self.taskhash:
275 h = self.taskhash[k] 281 h = self.taskhash[k]
276 else: 282 else:
277 # If k is not in basehash, then error 283 # If k is not in basehash, then error
278 h = self.basehash[k] 284 h = self.basehash[k]
279 return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.') 285 return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.')
280 286
287 def stampcleanmask(self, stampbase, fn, taskname, extrainfo):
288 return self.stampfile(stampbase, fn, taskname, extrainfo, clean=True)
289
281 def invalidate_task(self, task, d, fn): 290 def invalidate_task(self, task, d, fn):
282 bb.note("Tainting hash to force rebuild of task %s, %s" % (fn, task)) 291 bb.note("Tainting hash to force rebuild of task %s, %s" % (fn, task))
283 bb.build.write_taint(task, d, fn) 292 bb.build.write_taint(task, d, fn)