aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/siggen.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-06-18 16:45:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-21 13:10:32 +0100
commit5bd11a9bf329217f312076f347b045b5c09f19b2 (patch)
tree83714e56d5ba70a16cac099af85f7674300b1ba1 /bitbake/lib/bb/siggen.py
parentabc0bef595bbedf1fea8c6e0b1dc0c0becdd5b17 (diff)
downloadopenembedded-core-contrib-5bd11a9bf329217f312076f347b045b5c09f19b2.tar.gz
bitbake: bitbake: ensure -f causes dependent tasks to be re-run
If -f is specified, force dependent tasks to be re-run next time. This works by changing the force behaviour so that instead of deleting the task's stamp, we write a "taint" file into the stamps directory, which will alter the taskhash randomly and thus trigger the task to re-run next time we evaluate whether or not that should be done as well as influencing the taskhashes of any dependent tasks so that they are similarly re-triggered. As a bonus because we write this file as <stamp file name>.taskname.taint, the existing code which deletes the stamp files in OE's do_clean will already handle removing it. This means you can now do the following: bitbake somepackage [ change the source code in the package's WORKDIR ] bitbake -c compile -f somepackage bitbake somepackage and the result will be that all of the tasks that depend on do_compile (do_install, do_package, etc.) will be re-run in the last step. Note that to operate in the manner described above you need full hashing enabled (i.e. BB_SIGNATURE_HANDLER must be set to a signature handler that inherits from BasicHash). If this is not the case, -f will just delete the stamp for the specified task as it did before. This fix is required for [YOCTO #2615] and [YOCTO #2256]. (Bitbake rev: f7b55a94226f9acd985f87946e26d01bd86a35bb) 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/siggen.py')
-rw-r--r--bitbake/lib/bb/siggen.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index c4b7c3992e..0fb2642529 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -50,6 +50,10 @@ class SignatureGenerator(object):
def dump_sigtask(self, fn, task, stampbase, runtime):
return
+ def invalidate_task(self, task, d, fn):
+ bb.build.del_stamp(task, d, fn)
+
+
class SignatureGeneratorBasic(SignatureGenerator):
"""
"""
@@ -153,6 +157,15 @@ class SignatureGeneratorBasic(SignatureGenerator):
return False
return True
+ def read_taint(self, fn, task, stampbase):
+ taint = None
+ try:
+ with open(stampbase + '.' + task + '.taint', 'r') as taintf:
+ taint = taintf.read()
+ except IOError:
+ pass
+ return taint
+
def get_taskhash(self, fn, task, deps, dataCache):
k = fn + "." + task
data = dataCache.basetaskhash[k]
@@ -173,6 +186,11 @@ class SignatureGeneratorBasic(SignatureGenerator):
for (f,cs) in checksums:
self.file_checksum_values[k][f] = cs
data = data + cs
+
+ taint = self.read_taint(fn, task, dataCache.stamp[fn])
+ if taint:
+ data = data + taint
+
h = hashlib.md5(data).hexdigest()
self.taskhash[k] = h
#d.setVar("BB_TASKHASH_task-%s" % task, taskhash[task])
@@ -214,6 +232,10 @@ class SignatureGeneratorBasic(SignatureGenerator):
for dep in data['runtaskdeps']:
data['runtaskhashes'][dep] = self.taskhash[dep]
+ taint = self.read_taint(fn, task, stampbase)
+ if taint:
+ data['taint'] = taint
+
with open(sigfile, "wb") as f:
p = pickle.Pickler(f, -1)
p.dump(data)
@@ -245,6 +267,9 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic):
h = self.basehash[k]
return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.')
+ def invalidate_task(self, task, d, fn):
+ bb.build.write_taint(task, d, fn)
+
def dump_this_task(outfile, d):
import bb.parse
fn = d.getVar("BB_FILENAME", True)
@@ -357,6 +382,13 @@ def compare_sigfiles(a, b):
for dep in changed:
print "Hash for dependent task %s changed from %s to %s" % (dep, a[dep], b[dep])
+
+ a_taint = a_data.get('taint', None)
+ b_taint = b_data.get('taint', None)
+ if a_taint != b_taint:
+ print "Taint (by forced/invalidated task) changed from %s to %s" % (a_taint, b_taint)
+
+
def dump_sigfile(a):
p1 = pickle.Unpickler(open(a, "rb"))
a_data = p1.load()
@@ -384,3 +416,6 @@ def dump_sigfile(a):
if 'runtaskhashes' in a_data:
for dep in a_data['runtaskhashes']:
print "Hash for dependent task %s is %s" % (dep, a_data['runtaskhashes'][dep])
+
+ if 'taint' in a_data:
+ print "Tainted (by forced/invalidated task): %s" % a_data['taint']