public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Julien Stephan <jstephan@baylibre.com>,
	 openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v4 2/5] bitbake: cooker: add a new function to retrieve task signatures
Date: Fri, 11 Aug 2023 16:16:33 +0100	[thread overview]
Message-ID: <00a6e58926e3f691480af10389c82410a2182443.camel@linuxfoundation.org> (raw)
In-Reply-To: <jko5mkbz3wiunslj7oavugxa44am24g4wofe27xr7ws4mdubh5@gxtuugrb7v5d>

On Wed, 2023-08-02 at 16:44 +0200, Julien Stephan wrote:
> On Wed, Aug 02, 2023 at 04:24:29PM +0200, Julien Stephan wrote:
> > 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  | 16 ++++++++++++++++
> >  bitbake/lib/bb/event.py   |  8 ++++++++
> >  3 files changed, 30 insertions(+)
> > 
> > diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
> > index a355f56c60c..12202779ac0 100644
> > --- a/bitbake/lib/bb/command.py
> > +++ b/bitbake/lib/bb/command.py
> > @@ -776,3 +776,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 11c9fa2c40d..687cdde5e6d 100644
> > --- a/bitbake/lib/bb/cooker.py
> > +++ b/bitbake/lib/bb/cooker.py
> > @@ -1542,6 +1542,22 @@ class BBCooker:
> > 
> >          self.idleCallBackRegister(buildFileIdle, rq)
> > 
> > +    def getTaskSignatures(self, target, task):
> > +        sig = []
> > +
> > +        taskdata, runlist = self.buildTaskData(target, "do_build", self.configuration.halt)
> > +        rq = bb.runqueue.RunQueue(self, self.data, self.recipecaches, taskdata, runlist)
> > +        rq.rqdata.prepare()
> > +
> > +        for key in rq.rqdata.runtaskentries:
> > +            pn = bb.parse.siggen.tidtopn[key]
> > +            taskname = bb.runqueue.taskname_from_tid(key)
> > +            if pn in target:
> > +                if (task and taskname in task) or (not task):
> > +                    rq.rqdata.prepare_task_hash(key)
> > +                    sig.append([pn, taskname, rq.rqdata.get_task_unihash(key)])
> > +        return sig
> > +

Firstly, thanks for working on this! These changes aren't simple and it
means the review takes longer as we need to get this right.

> I would like some feedback on this function. The goal of this function
> was to be able to get a task signature (for bblock to use it, see bblock
> series). The idea was:
> - get the task signatures of "task"
> - if "task" is empty, get the signature of all tasks
> 
> Using buildTaskData with "do_build" task gives me almost all tasks
> signatures, at least, the "normal recipe build tasks" according to the doc [1].
> But we don't get the signatures for the "Manually called Tasks"
> 
> At first I thought it would be good enough for bblock use case, but now
> I am not so sure anymore:
> * for oeqa self test, I need to have access to the same list of tasks,

I think you need to query the tasks available for a recipe, remove the
"nostamp" ones and then return the signatures for the rest.

>   but running `bitbake -c listtasks` gives *all* the tasks
> * this function as is is not generic enough: we cannot get the task
>   signature for all the "manually called tasks" (but is that really a
>   problem?)
> * bblock cannot lock those tasks
> 
> So what do you think? Should I make this function more generic and
> called it several times to get *all* the tasks signature?

I think bitbake should internally be able to work out the nostamp ones
and return a list of all of them with the nostamp ones excluded.

Let me know if you need some pointers on how to do that in bitbake, it
isn't entirely straightforward and I'd have to look it up. I *think*
(without looking to know for sure) that the dataCache object does have
the task data in it which can be looked up by target and that lists
which ones are nostamp.

Cheers,

Richard




  reply	other threads:[~2023-08-11 15:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 14:24 [PATCH v4 0/5] Add bblock helper scripts Julien Stephan
2023-08-02 14:24 ` [PATCH v4 1/5] bitbake.conf: include bblock.conf Julien Stephan
2023-08-02 14:24 ` [PATCH v4 2/5] bitbake: cooker: add a new function to retrieve task signatures Julien Stephan
2023-08-02 14:44   ` Julien Stephan
2023-08-11 15:16     ` Richard Purdie [this message]
2023-08-22  9:27       ` [OE-core] " Julien Stephan
2023-09-14 13:26         ` Richard Purdie
2023-08-02 14:24 ` [PATCH v4 3/5] sstatesig: add a new info level for SIGGEN_LOCKEDSIGS_TASKSIG_CHECK Julien Stephan
2023-08-11 15:19   ` [OE-core] " Richard Purdie
2023-08-02 14:24 ` [PATCH v4 4/5] scripts/bblock: add a script to lock/unlock recipes Julien Stephan
2023-08-02 14:24 ` [PATCH v4 5/5] oeqa/selftest/bblock: add self test for bblock tool Julien Stephan
2023-08-03  2:57 ` [OE-core] [PATCH v4 0/5] Add bblock helper scripts Chen, Qi
2023-08-03  7:19   ` Julien Stephan
2023-08-10 13:21 ` Alexandre Belloni
2023-08-11  8:00   ` Alexandre Belloni
2023-08-11  8:45     ` Alexandre Belloni
2023-09-20 14:20       ` Julien Stephan
2023-09-21 13:11         ` Alexandre Belloni
2023-09-21 14:24           ` Julien Stephan
2023-09-21 21:58             ` Alexandre Belloni
2023-09-22  8:54               ` Julien Stephan
2023-09-22  9:50                 ` Alexandre Belloni

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=00a6e58926e3f691480af10389c82410a2182443.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox