All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Stephan <jstephan@baylibre.com>
To: openembedded-core@lists.openembedded.org
Cc: Julien Stephan <jstephan@baylibre.com>
Subject: [PATCH v5 2/5] bitbake: cooker: add a new function to retrieve task signatures
Date: Mon, 25 Sep 2023 10:04:49 +0200	[thread overview]
Message-ID: <20230925080452.803540-3-jstephan@baylibre.com> (raw)
In-Reply-To: <20230925080452.803540-1-jstephan@baylibre.com>

adding a new command in cooker to compute and get task signatures

this commit also add the associated command and event needed to get the
signatures using tinfoil

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
 bitbake/lib/bb/command.py |  6 ++++++
 bitbake/lib/bb/cooker.py  | 31 +++++++++++++++++++++++++++++++
 bitbake/lib/bb/event.py   |  8 ++++++++
 3 files changed, 45 insertions(+)

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 8663eed9331..f2ee5871616 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -781,3 +781,9 @@ class CommandsAsync:
         bb.event.fire(bb.event.FindSigInfoResult(res), command.cooker.databuilder.mcdata[mc])
         command.finishAsyncCommand()
     findSigInfo.needcache = False
+
+    def getTaskSignatures(self, command, params):
+        res = command.cooker.getTaskSignatures(params[0], params[1])
+        bb.event.fire(bb.event.GetTaskSignatureResult(res), command.cooker.data)
+        command.finishAsyncCommand()
+    getTaskSignatures.needcache = True
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 87aa71bb657..599c7ddaa28 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1442,6 +1442,37 @@ class BBCooker:
 
         self.idleCallBackRegister(buildFileIdle, rq)
 
+    def getTaskSignatures(self, target, tasks):
+        sig = []
+        getAllTaskSignatures = False
+
+        if not tasks:
+            tasks = ["do_build"]
+            getAllTaskSignatures = True
+
+        for task in tasks:
+            taskdata, runlist = self.buildTaskData(target, task, self.configuration.halt)
+            rq = bb.runqueue.RunQueue(self, self.data, self.recipecaches, taskdata, runlist)
+            rq.rqdata.prepare()
+
+            for l in runlist:
+                mc, pn, taskname, fn = l
+
+                taskdep = rq.rqdata.dataCaches[mc].task_deps[fn]
+                for t in taskdep['tasks']:
+                    if t in taskdep['nostamp'] or "setscene" in t:
+                        continue
+                    tid = bb.runqueue.build_tid(mc, fn, t)
+
+                    if t in task or getAllTaskSignatures:
+                        try:
+                            rq.rqdata.prepare_task_hash(tid)
+                            sig.append([pn, t, rq.rqdata.get_task_unihash(tid)])
+                        except KeyError:
+                            sig.append(self.getTaskSignatures(target, [t])[0])
+
+        return sig
+
     def buildTargets(self, targets, task):
         """
         Attempt to build the targets specified
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 0d0e0a68aac..f8acacd80d1 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -857,6 +857,14 @@ class FindSigInfoResult(Event):
         Event.__init__(self)
         self.result = result
 
+class GetTaskSignatureResult(Event):
+    """
+    Event to return results from GetTaskSignatures command
+    """
+    def __init__(self, sig):
+        Event.__init__(self)
+        self.sig = sig
+
 class ParseError(Event):
     """
     Event to indicate parse failed
-- 
2.41.0



  parent reply	other threads:[~2023-09-25  8:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25  8:04 [PATCH v5 0/5] Add bblock helper scripts Julien Stephan
2023-09-25  8:04 ` [PATCH v5 1/5] bitbake.conf: include bblock.conf Julien Stephan
2023-09-25  8:04 ` Julien Stephan [this message]
2023-09-25  8:04 ` [PATCH v5 3/5] sstatesig: add a new info level for SIGGEN_LOCKEDSIGS_TASKSIG_CHECK Julien Stephan
2023-09-25  8:04 ` [PATCH v5 4/5] scripts/bblock: add a script to lock/unlock recipes Julien Stephan
2023-09-25  8:04 ` [PATCH v5 5/5] oeqa/selftest/bblock: add self test for bblock tool Julien Stephan
2023-09-27 10:16 ` [OE-core] [PATCH v5 0/5] Add bblock helper scripts Alexandre Belloni
2023-09-27 12:47   ` Julien Stephan
2023-09-27 12:58     ` Alexandre Belloni
2023-09-27 12:59     ` Alexander Kanavin
2023-09-27 13:02       ` Julien Stephan
2023-09-27 13:04         ` Alexandre Belloni
2023-09-27 21:17     ` Richard Purdie
2023-09-30 14:13       ` Julien Stephan
2023-10-02 10:24         ` Jose Quaresma
2023-10-05  8:02           ` Julien Stephan
2023-10-06 10:56             ` Alexandre Belloni
2023-10-06 10:59               ` Richard Purdie
2023-10-06 12:37                 ` Julien Stephan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230925080452.803540-3-jstephan@baylibre.com \
    --to=jstephan@baylibre.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.