All of lore.kernel.org
 help / color / mirror / Atom feed
* bitbake addtask bbclass dependancies
@ 2022-02-11 17:55 Martin Leduc
  2022-02-11 22:06 ` [bitbake-devel] " Christopher Larson
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Leduc @ 2022-02-11 17:55 UTC (permalink / raw)
  To: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

Hi everyone,

I try to figure if the approach is good.

For my embeeded image, I need to run a function name do_thisattheend.  The approach I've is:

Into a thisattheend.bbclass file, I write:

inherit logging
do_thisattheend () {
bbplain Well, it's done
}

do_thisattheend [nostamp] = "1"

addtask after do_image_complete

bitbake show the do_rootfs execution, a little quickly do_image_complete and done.

If I replace addtask thisattheend a fter do_image_complete
by addtask thisattheend before do_build after do_image_complete
I see Well, it's done
And I see it 2 times, when my comprehension is the do_image_complete is called one time.

I've to say that I'm confused about the dependency structure and layout because when I look at the picture:

The do_image_complete is the last state of the build process, exactly where I need to run my task.

What I'm doing wrong?

Any help is appreciated.

Thank you

[-- Attachment #2: Type: text/html, Size: 24813 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bitbake-devel] bitbake addtask bbclass dependancies
  2022-02-11 17:55 bitbake addtask bbclass dependancies Martin Leduc
@ 2022-02-11 22:06 ` Christopher Larson
  2022-02-12 14:04   ` [EXTERNAL] " Martin Leduc
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2022-02-11 22:06 UTC (permalink / raw)
  To: bitbake-devel, Martin Leduc

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run (i.e. our default task, do_build, see BB_DEFAULT_TASK). i.e. addtask thisattheend after do_image_complete before do_build.

--
Christopher “kergoth” Larson
chris_larson@mentor.com, chris.larson@siemens.com, kergoth@gmail.com
On Feb 11, 2022, 10:55 AM -0700, Martin Leduc <martin.leduc@luminator.com>, wrote:
> Hi everyone,
>
> I try to figure if the approach is good.
>
> For my embeeded image, I need to run a function name do_thisattheend.  The approach I've is:
>
> Into a thisattheend.bbclass file, I write:
>
> inherit logging
> do_thisattheend () {
> bbplain Well, it's done
> }
>
> do_thisattheend[nostamp] = "1"
>
> addtask after do_image_complete
>
>
> bitbake show the do_rootfs execution, a little quickly do_image_complete and done.
>
> If I replace addtask thisattheend after do_image_complete
> by addtask thisattheend before do_build after do_image_complete
> I see Well, it's done
>
> And I see it 2 times, when my comprehension is the do_image_complete is called one time.
>
>
> I've to say that I'm confused about the dependency structure and layout because when I look at the picture:
>
> <dummyfile.0.part>
>
> The do_image_complete is the last state of the build process, exactly where I need to run my task.
>
>
>
> What I'm doing wrong?
>
>
>
> Any help is appreciated.
>
>
>
> Thank you
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#13340): https://lists.openembedded.org/g/bitbake-devel/message/13340
> Mute This Topic: https://lists.openembedded.org/mt/89077246/3617123
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [kergoth@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

[-- Attachment #2: Type: text/html, Size: 4422 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [EXTERNAL] Re: [bitbake-devel] bitbake addtask bbclass dependancies
  2022-02-11 22:06 ` [bitbake-devel] " Christopher Larson
@ 2022-02-12 14:04   ` Martin Leduc
  2022-02-14 20:26     ` Quentin Schulz
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Leduc @ 2022-02-12 14:04 UTC (permalink / raw)
  To: Christopher Larson, bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 3934 bytes --]

Hi Christopher,

Thank you for this fast answer.  I’ve tested your suggestions, and it works.  Thank you but, this put me more in the dark by 2 topics because I try to understand.

#1: when you say:

Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run

Did I don’t explicitely don’t request to run it by defining task to be run after do_image_complete?

In build recipes and based on the diagram shown into the mega manual, if the do_rootfs is run, the do_image_complete will be call after the do_rootfs right?.
So, again, in my mind, if I have one bbclass file having:

do_thisattheend () { …}

do_thisattheend2 () {…}

addtask thisattheend after do_image_complete
addtask thisattheend2 after thisattheend

I explicitely ask them to be runned no?

#2: do_build …  why do_build?
MEGA MANUAL: 27.1.1. do_build¶<https://www.yoctoproject.org/docs/2.7.4/mega-manual/mega-manual.html#ref-tasks-build>

The default task for all recipes. This task depends on all other normal tasks required to build a recipe.
I don’t intend to build a recipe, my intention is to run x functions AFTER the do_image_complete so why the do_build is invoked in that scenario?

Thank you so much for your answers

Martin Leduc
T : (418) 856-6896
martin.leduc@luminator.com<mailto:martin.leduc@axiontech.ca>


De : Christopher Larson <kergoth@gmail.com>
Envoyé : 11 février 2022 17:06
À : bitbake-devel@lists.openembedded.org; Martin Leduc <martin.leduc@luminator.com>
Objet : [EXTERNAL] Re: [bitbake-devel] bitbake addtask bbclass dependancies

CAUTION: This email originated from outside of Luminator Technology Group. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run (i.e. our default task, do_build, see BB_DEFAULT_TASK). i.e. addtask thisattheend after do_image_complete before do_build.

--
Christopher “kergoth” Larson
chris_larson@mentor.com<mailto:chris_larson@mentor.com>, chris.larson@siemens.com<mailto:chris.larson@siemens.com>, kergoth@gmail.com<mailto:kergoth@gmail.com>
On Feb 11, 2022, 10:55 AM -0700, Martin Leduc <martin.leduc@luminator.com<mailto:martin.leduc@luminator.com>>, wrote:

Hi everyone,

I try to figure if the approach is good.

For my embeeded image, I need to run a function name do_thisattheend.  The approach I've is:

Into a thisattheend.bbclass file, I write:

inherit logging

do_thisattheend () {

bbplain Well, it's done

}



do_thisattheend[nostamp] =
"1"



addtask after do_image_complete




bitbake show the do_rootfs execution, a little quickly do_image_complete and done.

If I replace addtask
thisattheend after do_image_complete

by addtask
thisattheend
before do_build after do_image_complete

I see
Well, it's done

And I see it 2 times, when my comprehension is the do_image_complete is called one time.





I've to say that I'm confused about the dependency structure and layout because when I look at the picture:



<dummyfile.0.part>

The do_image_complete is the last state of the build process, exactly where I need to run my task.



What I'm doing wrong?



Any help is appreciated.



Thank you
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13340): https://lists.openembedded.org/g/bitbake-devel/message/13340
Mute This Topic: https://lists.openembedded.org/mt/89077246/3617123
Group Owner: bitbake-devel+owner@lists.openembedded.org<mailto:bitbake-devel+owner@lists.openembedded.org>
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [kergoth@gmail.com]
-=-=-=-=-=-=-=-=-=-=-=-

[-- Attachment #2: Type: text/html, Size: 16290 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bitbake-devel] bitbake addtask bbclass dependancies
  2022-02-12 14:04   ` [EXTERNAL] " Martin Leduc
@ 2022-02-14 20:26     ` Quentin Schulz
       [not found]       ` <9f468cec364187d1c6ac66bc2c28848a6cb625b0.camel@linuxfoundation.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Quentin Schulz @ 2022-02-14 20:26 UTC (permalink / raw)
  To: Martin Leduc, Christopher Larson, bitbake-devel

Hi Martin,

On February 12, 2022 3:04:47 PM GMT+01:00, Martin Leduc <martin.leduc@luminator.com> wrote:
>Hi Christopher,
>
>Thank you for this fast answer.  I’ve tested your suggestions, and it works.  Thank you but, this put me more in the dark by 2 topics because I try to understand.
>
>#1: when you say:
>
>Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run
>
>Did I don’t explicitely don’t request to run it by defining task to be run after do_image_complete?
>

Imagine a tree of tasks, each node (task) having their dependencies represented as parent nodes. When you Bitbake a task, all parent nodes (hence dependencies) are run first (from "root" task, usually fetch) and then the actual requested node is run. Anything that is not required for the task to be run won't be run, that is an obvious performance choice. It is very rare to have tasks that aren't dependent on other tasks, meaning if we were to build all tasks with a dependency, the build would take much longer and we would run tasks that aren't interesting.

Take the example of menuconfig of the Linux kernel. To be able to run this, you obviously need the sources of the kernel, but do you want this task to be run every time the Linux kernel is fetched or built? Probably not.

>In build recipes and based on the diagram shown into the mega manual, if the do_rootfs is run, the do_image_complete will be call after the do_rootfs right?.

Not always no. You can run do_rootfs without running do_image_complete by requesting Bitbake to run the do_rootfs task (and its dependencies) only. This is done by doing:
bitbake -c do_rootfs myimage-recipe

>So, again, in my mind, if I have one bbclass file having:
>
>do_thisattheend () { …}
>
>do_thisattheend2 () {…}
>
>addtask thisattheend after do_image_complete
>addtask thisattheend2 after thisattheend
>
>I explicitely ask them to be runned no?
>

No. You explicitly ask thisattheend2 to run thisattheend task when requested to be run and do_image_complete to be run when thisattheend task is requested to be run.

>#2: do_build …  why do_build?
>MEGA MANUAL: 27.1.1. do_build¶<https://www.yoctoproject.org/docs/2.7.4/mega-manual/mega-manual.html#ref-tasks-build>
>
>The default task for all recipes. This task depends on all other normal tasks required to build a recipe.
>I don’t intend to build a recipe, my intention is to run x functions AFTER the do_image_complete so why the do_build is invoked in that scenario?
>

An image recipe is a recipe. When you run:
bitbake myimage-recipe
you're building a recipe. An image recipe. You're also actually running the do_build task of myimage-recipe. Which in turns make Bitbake run all dependencies of do_build of that image recipe. Since do_image_complete is a dependency of do_build, it'll get run. However, your custom task, is not a dependency of do_build. Instead it has a dependency of do_image_complete.
If you want it to run you need to either run it directly, or add it to a task that is a dependency of the task you're running (usually do_build at the very least) or you make it a direct dependency of this task.

The after and before words do not convey the same meaning in English than it does in Bitbake.

Replace "after" by "depends on" and "before" by "is depended on by", that might help to draw the picture in your mind of those dependencies and how they interact with each other.

Cheers,
Quentin

>Thank you so much for your answers
>
>Martin Leduc
>T : (418) 856-6896
>martin.leduc@luminator.com<mailto:martin.leduc@axiontech.ca>
>
>
>De : Christopher Larson <kergoth@gmail.com>
>Envoyé : 11 février 2022 17:06
>À : bitbake-devel@lists.openembedded.org; Martin Leduc <martin.leduc@luminator.com>
>Objet : [EXTERNAL] Re: [bitbake-devel] bitbake addtask bbclass dependancies
>
>CAUTION: This email originated from outside of Luminator Technology Group. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run (i.e. our default task, do_build, see BB_DEFAULT_TASK). i.e. addtask thisattheend after do_image_complete before do_build.
>
>--
>Christopher “kergoth” Larson
>chris_larson@mentor.com<mailto:chris_larson@mentor.com>, chris.larson@siemens.com<mailto:chris.larson@siemens.com>, kergoth@gmail.com<mailto:kergoth@gmail.com>
>On Feb 11, 2022, 10:55 AM -0700, Martin Leduc <martin.leduc@luminator.com<mailto:martin.leduc@luminator.com>>, wrote:
>
>Hi everyone,
>
>I try to figure if the approach is good.
>
>For my embeeded image, I need to run a function name do_thisattheend.  The approach I've is:
>
>Into a thisattheend.bbclass file, I write:
>
>inherit logging
>
>do_thisattheend () {
>
>bbplain Well, it's done
>
>}
>
>
>
>do_thisattheend[nostamp] =
>"1"
>
>
>
>addtask after do_image_complete
>
>
>
>
>bitbake show the do_rootfs execution, a little quickly do_image_complete and done.
>
>If I replace addtask
>thisattheend after do_image_complete
>
>by addtask
>thisattheend
>before do_build after do_image_complete
>
>I see
>Well, it's done
>
>And I see it 2 times, when my comprehension is the do_image_complete is called one time.
>
>
>
>
>
>I've to say that I'm confused about the dependency structure and layout because when I look at the picture:
>
>
>
><dummyfile.0.part>
>
>The do_image_complete is the last state of the build process, exactly where I need to run my task.
>
>
>
>What I'm doing wrong?
>
>
>
>Any help is appreciated.
>
>
>
>Thank you
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [EXTERNAL] Re: [bitbake-devel] bitbake addtask bbclass dependancies
       [not found]       ` <9f468cec364187d1c6ac66bc2c28848a6cb625b0.camel@linuxfoundation.org>
@ 2022-02-15 10:23         ` Martin Leduc
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Leduc @ 2022-02-15 10:23 UTC (permalink / raw)
  To: Richard Purdie, Quentin Schulz, Christopher Larson, bitbake-devel

HI to all,

Thank you so much for your explanations.  His name, bitbake, was well chosen (bit bake).  I think I've to work on the different functions and, I've to learn in deep Python.

Again, thank you guy's, you solved my issues and fix my comprehension of all of this.

Cheers,

Martin Leduc
T : (418) 856-6896
martin.leduc@luminator.com


-----Message d'origine-----
De : Richard Purdie <richard.purdie@linuxfoundation.org> 
Envoyé : 14 février 2022 18:10
À : Quentin Schulz <foss@0leil.net>; Martin Leduc <martin.leduc@luminator.com>; Christopher Larson <kergoth@gmail.com>; bitbake-devel@lists.openembedded.org
Objet : [EXTERNAL] Re: [bitbake-devel] bitbake addtask bbclass dependancies

CAUTION: This email originated from outside of Luminator Technology Group. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Mon, 2022-02-14 at 21:26 +0100, Quentin Schulz wrote:
> On February 12, 2022 3:04:47 PM GMT+01:00, Martin Leduc 
> <martin.leduc@luminator.com> wrote:
>
>
> > #2: do_build …  why do_build?
> > MEGA MANUAL: 27.1.1.
> > do_build¶<https://www.yoctoproject.org/docs/2.7.4/mega-manual/mega-m
> > anual.html#ref-tasks-build
> > >
> >
> > The default task for all recipes. This task depends on all other 
> > normal tasks required to build a recipe.
> > I don’t intend to build a recipe, my intention is to run x functions 
> > AFTER the do_image_complete so why the do_build is invoked in that scenario?
> >
>
> An image recipe is a recipe. When you run:
> bitbake myimage-recipe
> you're building a recipe. An image recipe. You're also actually 
> running the do_build task of myimage-recipe. Which in turns make 
> Bitbake run all dependencies of do_build of that image recipe. Since 
> do_image_complete is a dependency of do_build, it'll get run. However, 
> your custom task, is not a dependency of do_build. Instead it has a dependency of do_image_complete.
> If you want it to run you need to either run it directly, or add it to 
> a task that is a dependency of the task you're running (usually 
> do_build at the very
> least) or you make it a direct dependency of this task.
>
> The after and before words do not convey the same meaning in English 
> than it does in Bitbake.
>
> Replace "after" by "depends on" and "before" by "is depended on by", 
> that might help to draw the picture in your mind of those dependencies 
> and how they interact with each other.

Put another way, you requested "after do_image_complete" but you didn't specify it had to run before any other task. This means it ends up as an endpoint on the task graph and the only way to run it is to call it directly. Sometimes this is what you need/want.

The default task is "do_build" so "bitbake some-image" is really "bitbake -c build some-image". If you want the task to run as part of the default build, you'd specify "before do_build" as well as the after constraint.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-15 10:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11 17:55 bitbake addtask bbclass dependancies Martin Leduc
2022-02-11 22:06 ` [bitbake-devel] " Christopher Larson
2022-02-12 14:04   ` [EXTERNAL] " Martin Leduc
2022-02-14 20:26     ` Quentin Schulz
     [not found]       ` <9f468cec364187d1c6ac66bc2c28848a6cb625b0.camel@linuxfoundation.org>
2022-02-15 10:23         ` [EXTERNAL] " Martin Leduc

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.