mbox series

[RFC,v2,0/2] Add bblock helper script

Message ID 20230721142543.246415-1-jstephan@baylibre.com
Headers show
Series Add bblock helper script | expand

Message

Julien Stephan July 21, 2023, 2:25 p.m. UTC
Hi all,

This is the v2 of bblock script.

Improvement from V1:
* Signatures are now package architecture specific meaning that if you
  switch MACHINE, the lock sig will not be taken into account
* I added the -r option to unlock recipes
* I added a -d option to display the current bblock.conf
* Added an include directive for conf/bblock.conf inside bitbake.conf
* Added -t option to specify the tasks to lock/unlock

Limitations:
* I may be still missing some checks on user input
* I need to find a way to get the list of tasks ( by default still lock
  only the do_compile for now, unless -t is specified)
* Do not check if a particular recipe/task is already locked when trying
  to add lock. So entries may appear multiple times
* We still need the signature of the tasks to be already computed before
  locking. Need to find a way to generate it if missing

I did some tests using qemux86-64 and qemuarm but I may be missing some
corner cases.

I force pushed my branch on poky-contrib [1]

Any feedback are welcome!

Cheers
Julien

V1:
I am currently working on bug #13425 and I would like to post my wip
script as an RFC to get feedback on it, before going further in the
development.

The script `script/bblock` can be used with the following command:

bblock [list of recipes to lock]

Here is a summary of what is currently implemented:
* can lock several recipes at once
* on first execution bblock will append `require bblock.inc` in
  `build/conf/auto.conf` (creates `auto.conf` if it doesn't exist)
* on first execution creates the file `build/conf/bblock.inc` with a
  dedicated header and:
         - adds SIGGEN_LOCKEDSIGS_TYPES += "t-bblock"
         - adds SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn" to display warning but
           do not stop the build
* loops over all recipes to lock and adds entry with latest "do_compile"
  signature in `conf/bblock.inc`, such as: SIGGEN_LOCKEDSIGS_t-bblock += "bc:do_compile:e233cd793137a92dd575a417a2877e324ce526c4dc4a7db652abb9512f406f1f"

Limitations:
* only gets do_compile signature for now as a POC
* `bblock reset [list of recipes]` not yet implemented
* no check if a recipe is already locked

Steps to test the script:
bitbake bc --> generate a signature for bc's tasks
bblock bc
# modify do_compile in bc recipe to force signature change
bitbake bc --> throws the following warning: `WARNING: The bc:do_compile sig is computed to be 680bd6c291bf88e379e0c405a773cf5f81851e1a52570398cefd0196000ac1ef, but the sig is locked to e233cd793137a92dd575a417a2877e324ce526c4dc4a7db652abb9512f406f1f in SIGGEN_LOCKEDSIGS_t-bblock`

I also have a point I would like to discuss: I only get signature for
do_compile for the POC but wondering what should I do here:
* have a set of predefined task to lock, in that case how to choose the
  tasks?
* compute the list of all available tasks for a given recipe and get
  signature for all? Is there a way to get such list without using
  `infoil.build_targets(pn, "listtasks", handle_events=True)` as this
  will start bitbake, takes some time and requires some processing of
  the output
* add an option for the user to specify the task he wants to lock? (this
  may be useful to add anyway)

My branch is available here [1]

Am I going into the right direction?

Cheers
Julien

[1]: https://git.yoctoproject.org/poky-contrib/commit/?h=jstephan/bblock
Julien Stephan (2):
  bitbake.conf: include bblock.conf
  scripts/bblock: add a script to lock/unlock recipes

 meta/conf/bitbake.conf |   1 +
 scripts/bblock         | 184 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 185 insertions(+)
 create mode 100755 scripts/bblock

--
2.41.0

Comments

Alexander Kanavin July 23, 2023, 12:11 p.m. UTC | #1
Thanks for working on this. Should we think about how this could be tested?

Alex

On Fri, 21 Jul 2023 at 16:25, Julien Stephan <jstephan@baylibre.com> wrote:
>
> Hi all,
>
> This is the v2 of bblock script.
>
> Improvement from V1:
> * Signatures are now package architecture specific meaning that if you
>   switch MACHINE, the lock sig will not be taken into account
> * I added the -r option to unlock recipes
> * I added a -d option to display the current bblock.conf
> * Added an include directive for conf/bblock.conf inside bitbake.conf
> * Added -t option to specify the tasks to lock/unlock
>
> Limitations:
> * I may be still missing some checks on user input
> * I need to find a way to get the list of tasks ( by default still lock
>   only the do_compile for now, unless -t is specified)
> * Do not check if a particular recipe/task is already locked when trying
>   to add lock. So entries may appear multiple times
> * We still need the signature of the tasks to be already computed before
>   locking. Need to find a way to generate it if missing
>
> I did some tests using qemux86-64 and qemuarm but I may be missing some
> corner cases.
>
> I force pushed my branch on poky-contrib [1]
>
> Any feedback are welcome!
>
> Cheers
> Julien
>
> V1:
> I am currently working on bug #13425 and I would like to post my wip
> script as an RFC to get feedback on it, before going further in the
> development.
>
> The script `script/bblock` can be used with the following command:
>
> bblock [list of recipes to lock]
>
> Here is a summary of what is currently implemented:
> * can lock several recipes at once
> * on first execution bblock will append `require bblock.inc` in
>   `build/conf/auto.conf` (creates `auto.conf` if it doesn't exist)
> * on first execution creates the file `build/conf/bblock.inc` with a
>   dedicated header and:
>          - adds SIGGEN_LOCKEDSIGS_TYPES += "t-bblock"
>          - adds SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn" to display warning but
>            do not stop the build
> * loops over all recipes to lock and adds entry with latest "do_compile"
>   signature in `conf/bblock.inc`, such as: SIGGEN_LOCKEDSIGS_t-bblock += "bc:do_compile:e233cd793137a92dd575a417a2877e324ce526c4dc4a7db652abb9512f406f1f"
>
> Limitations:
> * only gets do_compile signature for now as a POC
> * `bblock reset [list of recipes]` not yet implemented
> * no check if a recipe is already locked
>
> Steps to test the script:
> bitbake bc --> generate a signature for bc's tasks
> bblock bc
> # modify do_compile in bc recipe to force signature change
> bitbake bc --> throws the following warning: `WARNING: The bc:do_compile sig is computed to be 680bd6c291bf88e379e0c405a773cf5f81851e1a52570398cefd0196000ac1ef, but the sig is locked to e233cd793137a92dd575a417a2877e324ce526c4dc4a7db652abb9512f406f1f in SIGGEN_LOCKEDSIGS_t-bblock`
>
> I also have a point I would like to discuss: I only get signature for
> do_compile for the POC but wondering what should I do here:
> * have a set of predefined task to lock, in that case how to choose the
>   tasks?
> * compute the list of all available tasks for a given recipe and get
>   signature for all? Is there a way to get such list without using
>   `infoil.build_targets(pn, "listtasks", handle_events=True)` as this
>   will start bitbake, takes some time and requires some processing of
>   the output
> * add an option for the user to specify the task he wants to lock? (this
>   may be useful to add anyway)
>
> My branch is available here [1]
>
> Am I going into the right direction?
>
> Cheers
> Julien
>
> [1]: https://git.yoctoproject.org/poky-contrib/commit/?h=jstephan/bblock
> Julien Stephan (2):
>   bitbake.conf: include bblock.conf
>   scripts/bblock: add a script to lock/unlock recipes
>
>  meta/conf/bitbake.conf |   1 +
>  scripts/bblock         | 184 +++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 185 insertions(+)
>  create mode 100755 scripts/bblock
>
> --
> 2.41.0
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#184697): https://lists.openembedded.org/g/openembedded-core/message/184697
> Mute This Topic: https://lists.openembedded.org/mt/100277504/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Julien Stephan July 24, 2023, 8:25 a.m. UTC | #2
On Sun, Jul 23, 2023 at 02:11:14PM +0200, Alexander Kanavin wrote:
> Thanks for working on this. Should we think about how this could be tested?
>
> Alex
>

Hi Alex,

Do you mean we should consider addind self test for bblock? or you want
to discuss about acceptance criteria for bblock?

Cheers
Julien
Alexander Kanavin July 24, 2023, 8:36 a.m. UTC | #3
On Mon, 24 Jul 2023 at 10:25, Julien Stephan <jstephan@baylibre.com> wrote:
> > Thanks for working on this. Should we think about how this could be tested?
> Do you mean we should consider addind self test for bblock? or you want
> to discuss about acceptance criteria for bblock?

Hello,
I mean mostly about what should be tested. How can we verify that the
script does what it's supposed to, in an automated way, so it won't
silently break as new changes to bitbake/oe-core are added? What
should such a test contain?
The specific form of tests (whether it's selftest, or maybe a part of
SDK testing, or something else) is secondary.

Alex
Julien Stephan July 27, 2023, 2:15 p.m. UTC | #4
On Mon, Jul 24, 2023 at 10:36:28AM +0200, Alexander Kanavin wrote:
> On Mon, 24 Jul 2023 at 10:25, Julien Stephan <jstephan@baylibre.com> wrote:
> > > Thanks for working on this. Should we think about how this could be tested?
> > Do you mean we should consider addind self test for bblock? or you want
> > to discuss about acceptance criteria for bblock?
>
> Hello,
> I mean mostly about what should be tested. How can we verify that the
> script does what it's supposed to, in an automated way, so it won't
> silently break as new changes to bitbake/oe-core are added? What
> should such a test contain?
> The specific form of tests (whether it's selftest, or maybe a part of
> SDK testing, or something else) is secondary.
>
> Alex

Hi Alex,

I just send the v3 with a lot of improvements!

Here is what I do during my dev:
- lock a recipe's task for a given arch (qemux86-64 vs qemuarm)
- modify the given task
- check that for the selected arch, task is locked (but not for other arch)

Maybe we need to be more formal with that?

I would be happy to provide a test script if needed.

Cheers
Julien
Alexander Kanavin July 27, 2023, 2:28 p.m. UTC | #5
Sure; if you can write a script and show it here, we can figure out
where to place the test officially.

Alex

On Thu, 27 Jul 2023 at 16:15, Julien Stephan <jstephan@baylibre.com> wrote:
>
> On Mon, Jul 24, 2023 at 10:36:28AM +0200, Alexander Kanavin wrote:
> > On Mon, 24 Jul 2023 at 10:25, Julien Stephan <jstephan@baylibre.com> wrote:
> > > > Thanks for working on this. Should we think about how this could be tested?
> > > Do you mean we should consider addind self test for bblock? or you want
> > > to discuss about acceptance criteria for bblock?
> >
> > Hello,
> > I mean mostly about what should be tested. How can we verify that the
> > script does what it's supposed to, in an automated way, so it won't
> > silently break as new changes to bitbake/oe-core are added? What
> > should such a test contain?
> > The specific form of tests (whether it's selftest, or maybe a part of
> > SDK testing, or something else) is secondary.
> >
> > Alex
>
> Hi Alex,
>
> I just send the v3 with a lot of improvements!
>
> Here is what I do during my dev:
> - lock a recipe's task for a given arch (qemux86-64 vs qemuarm)
> - modify the given task
> - check that for the selected arch, task is locked (but not for other arch)
>
> Maybe we need to be more formal with that?
>
> I would be happy to provide a test script if needed.
>
> Cheers
> Julien
Julien Stephan Aug. 7, 2023, 1:37 p.m. UTC | #6
Le jeu. 27 juil. 2023 à 16:28, Alexander Kanavin
<alex.kanavin@gmail.com> a écrit :
>
> Sure; if you can write a script and show it here, we can figure out
> where to place the test officially.
>
> Alex

Hi Alexander,

I sent a v4 with an oeqa self test. What do you think about it?
https://lists.openembedded.org/g/openembedded-core/message/185408

Cheers
Julien

>
> On Thu, 27 Jul 2023 at 16:15, Julien Stephan <jstephan@baylibre.com> wrote:
> >
> > On Mon, Jul 24, 2023 at 10:36:28AM +0200, Alexander Kanavin wrote:
> > > On Mon, 24 Jul 2023 at 10:25, Julien Stephan <jstephan@baylibre.com> wrote:
> > > > > Thanks for working on this. Should we think about how this could be tested?
> > > > Do you mean we should consider addind self test for bblock? or you want
> > > > to discuss about acceptance criteria for bblock?
> > >
> > > Hello,
> > > I mean mostly about what should be tested. How can we verify that the
> > > script does what it's supposed to, in an automated way, so it won't
> > > silently break as new changes to bitbake/oe-core are added? What
> > > should such a test contain?
> > > The specific form of tests (whether it's selftest, or maybe a part of
> > > SDK testing, or something else) is secondary.
> > >
> > > Alex
> >
> > Hi Alex,
> >
> > I just send the v3 with a lot of improvements!
> >
> > Here is what I do during my dev:
> > - lock a recipe's task for a given arch (qemux86-64 vs qemuarm)
> > - modify the given task
> > - check that for the selected arch, task is locked (but not for other arch)
> >
> > Maybe we need to be more formal with that?
> >
> > I would be happy to provide a test script if needed.
> >
> > Cheers
> > Julien
Alexander Kanavin Aug. 7, 2023, 1:47 p.m. UTC | #7
On Mon, 7 Aug 2023 at 15:38, Julien Stephan <jstephan@baylibre.com> wrote:
> I sent a v4 with an oeqa self test. What do you think about it?
> https://lists.openembedded.org/g/openembedded-core/message/185408

Right now I don't have any particular comments about v4, but others
do, I think? You may have to make further fixes if something fails in
QA with these changes.

Alex