diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-06-18 16:45:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-21 13:10:32 +0100 |
commit | 5bd11a9bf329217f312076f347b045b5c09f19b2 (patch) | |
tree | 83714e56d5ba70a16cac099af85f7674300b1ba1 /bitbake/lib/bb/siggen.py | |
parent | abc0bef595bbedf1fea8c6e0b1dc0c0becdd5b17 (diff) | |
download | poky-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.py | 35 |
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): | |||
50 | def dump_sigtask(self, fn, task, stampbase, runtime): | 50 | def dump_sigtask(self, fn, task, stampbase, runtime): |
51 | return | 51 | return |
52 | 52 | ||
53 | def invalidate_task(self, task, d, fn): | ||
54 | bb.build.del_stamp(task, d, fn) | ||
55 | |||
56 | |||
53 | class SignatureGeneratorBasic(SignatureGenerator): | 57 | class SignatureGeneratorBasic(SignatureGenerator): |
54 | """ | 58 | """ |
55 | """ | 59 | """ |
@@ -153,6 +157,15 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
153 | return False | 157 | return False |
154 | return True | 158 | return True |
155 | 159 | ||
160 | def read_taint(self, fn, task, stampbase): | ||
161 | taint = None | ||
162 | try: | ||
163 | with open(stampbase + '.' + task + '.taint', 'r') as taintf: | ||
164 | taint = taintf.read() | ||
165 | except IOError: | ||
166 | pass | ||
167 | return taint | ||
168 | |||
156 | def get_taskhash(self, fn, task, deps, dataCache): | 169 | def get_taskhash(self, fn, task, deps, dataCache): |
157 | k = fn + "." + task | 170 | k = fn + "." + task |
158 | data = dataCache.basetaskhash[k] | 171 | data = dataCache.basetaskhash[k] |
@@ -173,6 +186,11 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
173 | for (f,cs) in checksums: | 186 | for (f,cs) in checksums: |
174 | self.file_checksum_values[k][f] = cs | 187 | self.file_checksum_values[k][f] = cs |
175 | data = data + cs | 188 | data = data + cs |
189 | |||
190 | taint = self.read_taint(fn, task, dataCache.stamp[fn]) | ||
191 | if taint: | ||
192 | data = data + taint | ||
193 | |||
176 | h = hashlib.md5(data).hexdigest() | 194 | h = hashlib.md5(data).hexdigest() |
177 | self.taskhash[k] = h | 195 | self.taskhash[k] = h |
178 | #d.setVar("BB_TASKHASH_task-%s" % task, taskhash[task]) | 196 | #d.setVar("BB_TASKHASH_task-%s" % task, taskhash[task]) |
@@ -214,6 +232,10 @@ class SignatureGeneratorBasic(SignatureGenerator): | |||
214 | for dep in data['runtaskdeps']: | 232 | for dep in data['runtaskdeps']: |
215 | data['runtaskhashes'][dep] = self.taskhash[dep] | 233 | data['runtaskhashes'][dep] = self.taskhash[dep] |
216 | 234 | ||
235 | taint = self.read_taint(fn, task, stampbase) | ||
236 | if taint: | ||
237 | data['taint'] = taint | ||
238 | |||
217 | with open(sigfile, "wb") as f: | 239 | with open(sigfile, "wb") as f: |
218 | p = pickle.Pickler(f, -1) | 240 | p = pickle.Pickler(f, -1) |
219 | p.dump(data) | 241 | p.dump(data) |
@@ -245,6 +267,9 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic): | |||
245 | h = self.basehash[k] | 267 | h = self.basehash[k] |
246 | return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.') | 268 | return ("%s.%s.%s.%s" % (stampbase, taskname, h, extrainfo)).rstrip('.') |
247 | 269 | ||
270 | def invalidate_task(self, task, d, fn): | ||
271 | bb.build.write_taint(task, d, fn) | ||
272 | |||
248 | def dump_this_task(outfile, d): | 273 | def dump_this_task(outfile, d): |
249 | import bb.parse | 274 | import bb.parse |
250 | fn = d.getVar("BB_FILENAME", True) | 275 | fn = d.getVar("BB_FILENAME", True) |
@@ -357,6 +382,13 @@ def compare_sigfiles(a, b): | |||
357 | for dep in changed: | 382 | for dep in changed: |
358 | print "Hash for dependent task %s changed from %s to %s" % (dep, a[dep], b[dep]) | 383 | print "Hash for dependent task %s changed from %s to %s" % (dep, a[dep], b[dep]) |
359 | 384 | ||
385 | |||
386 | a_taint = a_data.get('taint', None) | ||
387 | b_taint = b_data.get('taint', None) | ||
388 | if a_taint != b_taint: | ||
389 | print "Taint (by forced/invalidated task) changed from %s to %s" % (a_taint, b_taint) | ||
390 | |||
391 | |||
360 | def dump_sigfile(a): | 392 | def dump_sigfile(a): |
361 | p1 = pickle.Unpickler(open(a, "rb")) | 393 | p1 = pickle.Unpickler(open(a, "rb")) |
362 | a_data = p1.load() | 394 | a_data = p1.load() |
@@ -384,3 +416,6 @@ def dump_sigfile(a): | |||
384 | if 'runtaskhashes' in a_data: | 416 | if 'runtaskhashes' in a_data: |
385 | for dep in a_data['runtaskhashes']: | 417 | for dep in a_data['runtaskhashes']: |
386 | print "Hash for dependent task %s is %s" % (dep, a_data['runtaskhashes'][dep]) | 418 | print "Hash for dependent task %s is %s" % (dep, a_data['runtaskhashes'][dep]) |
419 | |||
420 | if 'taint' in a_data: | ||
421 | print "Tainted (by forced/invalidated task): %s" % a_data['taint'] | ||