From 86ec266d912b574c2e2f2057c9c438b13c5c5f98 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 18 Mar 2021 17:57:45 +0000 Subject: bitbake: 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. (Bitbake rev: ef8c980a3ae92c168b7ca16a4d19cd38a9574761) Signed-off-by: Richard Purdie --- bitbake/lib/bb/event.py | 11 +++++++++++ bitbake/lib/bb/runqueue.py | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 31e7c2a4d2..0454c75332 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -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 diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 3008b7ad4f..80d7f6ca6b 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py @@ -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() -- cgit v1.2.3-54-g00ecf