diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-11 16:37:27 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-17 08:52:28 +0000 |
commit | 1a45c29ff13f6e78b9428336f813d0c3e0fd980a (patch) | |
tree | a723108d4783559eb983e94854fc4a0fbd042a94 /bitbake/lib/bb/siggen.py | |
parent | 878de40a501089048cffdc867b2ae1ad8a2ec9e5 (diff) | |
download | poky-1a45c29ff13f6e78b9428336f813d0c3e0fd980a.tar.gz |
bitbake: build/siggen: Rework stamps functions
The current method of passing either a task's datastore, or
dataCaches and a filename into the stamp functions is rather
horrible.
Due to the different contexts, fixing this is hard but we do control
the bitbake side of the API usage so we can migrate those to use other
functions and then only support a datastore in the public bb.build API
which is only called from task context in OE-Core.
(Bitbake rev: c79ecec580e4c2a141ae483ec0f6448f70593dcf)
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 | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index a63e37d22f..513f3811a1 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py | |||
@@ -106,17 +106,51 @@ class SignatureGenerator(object): | |||
106 | """Write/update the file checksum cache onto disk""" | 106 | """Write/update the file checksum cache onto disk""" |
107 | return | 107 | return |
108 | 108 | ||
109 | def stampfile_base(self, mcfn): | ||
110 | mc = bb.runqueue.mc_from_tid(mcfn) | ||
111 | return self.datacaches[mc].stamp[mcfn] | ||
112 | |||
113 | def stampfile_mcfn(self, taskname, mcfn, extrainfo=True): | ||
114 | mc = bb.runqueue.mc_from_tid(mcfn) | ||
115 | stamp = self.datacaches[mc].stamp[mcfn] | ||
116 | if not stamp: | ||
117 | return | ||
118 | |||
119 | stamp_extrainfo = "" | ||
120 | if extrainfo: | ||
121 | taskflagname = taskname | ||
122 | if taskname.endswith("_setscene"): | ||
123 | taskflagname = taskname.replace("_setscene", "") | ||
124 | stamp_extrainfo = self.datacaches[mc].stamp_extrainfo[mcfn].get(taskflagname) or "" | ||
125 | |||
126 | return self.stampfile(stamp, mcfn, taskname, stamp_extrainfo) | ||
127 | |||
109 | def stampfile(self, stampbase, file_name, taskname, extrainfo): | 128 | def stampfile(self, stampbase, file_name, taskname, extrainfo): |
110 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') | 129 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') |
111 | 130 | ||
131 | def stampcleanmask_mcfn(self, taskname, mcfn): | ||
132 | mc = bb.runqueue.mc_from_tid(mcfn) | ||
133 | stamp = self.datacaches[mc].stamp[mcfn] | ||
134 | if not stamp: | ||
135 | return [] | ||
136 | |||
137 | taskflagname = taskname | ||
138 | if taskname.endswith("_setscene"): | ||
139 | taskflagname = taskname.replace("_setscene", "") | ||
140 | stamp_extrainfo = self.datacaches[mc].stamp_extrainfo[mcfn].get(taskflagname) or "" | ||
141 | |||
142 | return self.stampcleanmask(stamp, mcfn, taskname, stamp_extrainfo) | ||
143 | |||
112 | def stampcleanmask(self, stampbase, file_name, taskname, extrainfo): | 144 | def stampcleanmask(self, stampbase, file_name, taskname, extrainfo): |
113 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') | 145 | return ("%s.%s.%s" % (stampbase, taskname, extrainfo)).rstrip('.') |
114 | 146 | ||
115 | def dump_sigtask(self, fn, task, stampbase, runtime): | 147 | def dump_sigtask(self, fn, task, stampbase, runtime): |
116 | return | 148 | return |
117 | 149 | ||
118 | def invalidate_task(self, task, d, fn): | 150 | def invalidate_task(self, task, mcfn): |
119 | bb.build.del_stamp(task, d, fn) | 151 | mc = bb.runqueue.mc_from_tid(mcfn) |
152 | stamp = self.datacaches[mc].stamp[mcfn] | ||
153 | bb.utils.remove(stamp) | ||
120 | 154 | ||
121 | def dump_sigs(self, dataCache, options): | 155 | def dump_sigs(self, dataCache, options): |
122 | return | 156 | return |
@@ -448,9 +482,20 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic): | |||
448 | def stampcleanmask(self, stampbase, fn, taskname, extrainfo): | 482 | def stampcleanmask(self, stampbase, fn, taskname, extrainfo): |
449 | return self.stampfile(stampbase, fn, taskname, extrainfo, clean=True) | 483 | return self.stampfile(stampbase, fn, taskname, extrainfo, clean=True) |
450 | 484 | ||
451 | def invalidate_task(self, task, d, fn): | 485 | def invalidate_task(self, task, mcfn): |
452 | bb.note("Tainting hash to force rebuild of task %s, %s" % (fn, task)) | 486 | bb.note("Tainting hash to force rebuild of task %s, %s" % (mcfn, task)) |
453 | bb.build.write_taint(task, d, fn) | 487 | |
488 | mc = bb.runqueue.mc_from_tid(mcfn) | ||
489 | stamp = self.datacaches[mc].stamp[mcfn] | ||
490 | |||
491 | taintfn = stamp + '.' + task + '.taint' | ||
492 | |||
493 | import uuid | ||
494 | bb.utils.mkdirhier(os.path.dirname(taintfn)) | ||
495 | # The specific content of the taint file is not really important, | ||
496 | # we just need it to be random, so a random UUID is used | ||
497 | with open(taintfn, 'w') as taintf: | ||
498 | taintf.write(str(uuid.uuid4())) | ||
454 | 499 | ||
455 | class SignatureGeneratorUniHashMixIn(object): | 500 | class SignatureGeneratorUniHashMixIn(object): |
456 | def __init__(self, data): | 501 | def __init__(self, data): |
@@ -693,7 +738,7 @@ def dump_this_task(outfile, d): | |||
693 | import bb.parse | 738 | import bb.parse |
694 | fn = d.getVar("BB_FILENAME") | 739 | fn = d.getVar("BB_FILENAME") |
695 | task = "do_" + d.getVar("BB_CURRENTTASK") | 740 | task = "do_" + d.getVar("BB_CURRENTTASK") |
696 | referencestamp = bb.build.stamp_internal(task, d, None, True) | 741 | referencestamp = bb.parse.siggen.stampfile_base(fn) |
697 | bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) | 742 | bb.parse.siggen.dump_sigtask(fn, task, outfile, "customfile:" + referencestamp) |
698 | 743 | ||
699 | def init_colors(enable_color): | 744 | def init_colors(enable_color): |