build: Add file_stale_stamps function
PATCH 1/2 build: Add file_stale_stamps function
Add a new function which compares the stamp filename we want (including taskhash) with what is in the stamp directory (using the clean mask). This tells us which stamp files are stale and are due to be rerun.
--- lib/bb/build.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
lib/bb/build.py +17 -0
@@ -854,6 +854,23 @@ def make_stamp(task, d, file_name = None): file_name = d.getVar('BB_FILENAME') bb.parse.siggen.dump_sigtask(file_name, task, stampbase, True) +def find_stale_stamps(task, d, file_name=None): + current = stamp_internal(task, d, file_name) + current2 = stamp_internal(task + "_setscene", d, file_name) + cleanmask = stamp_cleanmask_internal(task, d, file_name) + found = [] + for mask in cleanmask: + for name in glob.glob(mask): + if "sigdata" in name or "sigbasedata" in name: + continue + if name.endswith('.taint'): + continue + if name == current or name == current2: + continue + logger.debug2("Stampfile %s does not match %s or %s" % (name, current, current2)) + found.append(name) + return found + def del_stamp(task, d, file_name = None): """ Removes a stamp for a given task
Signature · 1 line
2.30.2
PATCH 2/2 runqueue/event: Add an event for notifying of stale setscene tasks
Use the new functionality in build.py to identify stale setscene tasks and send an event to the metadata listing them. The metadata then has the option of performing cleanup operations if it thinks that appropriate.
--- lib/bb/event.py | 11 +++++++++++ lib/bb/runqueue.py | 14 ++++++++++++++ 2 files changed, 25 insertions(+)
lib/bb/event.py +11 -0
@@ -670,6 +670,17 @@ class ReachableStamps(Event): Event.__init__(self) self.stamps = stamps +class StaleSetSceneTasks(Event): + """ + An event listing setscene tasks which are 'stale' and will + be rerun. The metadata may use to clean up stale data. + tasks is a mapping of tasks and matching stale stamps. + """ + + def __init__(self, tasks): + Event.__init__(self) + self.tasks = tasks + class FilesMatchingFound(Event): """ Event when a list of files matching the supplied pattern has
lib/bb/runqueue.py +14 -0
@@ -2781,6 +2781,20 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq): update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True) + # Compute a list of 'stale' sstate tasks where the current hash does not match the one + # in any stamp files. Pass the list out to metadata as an event. + found = {} + for tid in rqdata.runq_setscene_tids: + (mc, fn, taskname, taskfn) = split_tid_mcfn(tid) + stamps = bb.build.find_stale_stamps(taskname, rqdata.dataCaches[mc], taskfn) + if stamps: + if mc not in found: + found[mc] = {} + found[mc][tid] = stamps + for mc in found: + event = bb.event.StaleSetSceneTasks(found[mc]) + bb.event.fire(event, cooker.databuilder.mcdata[mc]) + def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True): tocheck = set()
Signature · 1 line
2.30.2
Quoted 14 lines · Richard Purdie
Add a new function which compares the stamp filename we want (including taskhash) with what is in the stamp directory (using the clean mask). This tells us which stamp files are stale and are due to be rerun.
Signed-off-by Richard Purdie <[email protected]>--- lib/bb/build.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)lib/bb/build.py +0
-0
lib/bb/build.py def make_stamp(task, d, file_name = None): · line 857
Quoted 4 lines
lib/bb/build.py +1
-0@@ -854,6 +854,23 @@ def make_stamp(task, d, file_name = None): file_name = d.getVar('BB_FILENAME') bb.parse.siggen.dump_sigtask(file_name, task, stampbase, True) +def find_stale_stamps(task, d, file_name=None):
subject does not match function name.
rday
Quoted 19 lines · Robert P. J. Day
Quoted 17 lines · Richard Purdie
Add a new function which compares the stamp filename we want (including taskhash) with what is in the stamp directory (using the clean mask). This tells us which stamp files are stale and are due to be rerun.
Signed-off-by Richard Purdie <[email protected]>---
lib/bb/build.py | 17 +++++++++++++++++1 file changed, 17 insertions(+)lib/bb/build.py +0
-0@@ -854,6 +854,23 @@ def make_stamp(task, d, file_name = None): file_name = d.getVar('BB_FILENAME') bb.parse.siggen.dump_sigtask(file_name, task, stampbase, True)
Quoted 3 lines
lib/bb/build.py def make_stamp(task, d, file_name = None): · line 857
Quoted 1 line
lib/bb/build.py +1
-0+def find_stale_stamps(task, d, file_name=None):subject does not match function name.
Fixed, thanks.
Richard