Bug 7733

Summary: Add an option to execute task for target and all of its dependent targets
Product: [Build System, Metadata & Runtime] BitBake Reporter: Paul Eggleton <bluelightning>
Component: bitbakeAssignee: Paul Eggleton <bluelightning>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Low CC: msm-oss, poky.bs.watcher, poky.watcher, richard.purdie, ross.burton
Version: 1.7   
Target Milestone: Future   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Paul Eggleton 2015-05-08 13:17:06 UTC
OE defines a "do_fetchall" task so you can run bitbake -c fetchall <target> and  do_fetch will be run for the specified target and all of its dependent targets. However, it would be useful if we could have this mechanism in generic form so you could use it with any task.

Furthermore, we'd want to ensure that -f worked with this option so you could force the task to run for targets where it's already run - one use case would be forcing do_package_qa to re-run for all dependent recipes.
Comment 1 Richard Purdie 2017-03-07 22:44:59 UTC
Note that this isn't just "all dependent recipes", to make this work, we actually have to traverse up the dependency tree and then back down it.

For example, "bitbake core-image-sato -c fetch" but when we want a "fetchall" task, we have to look at core-image-sato:do_build, then look for all fetch tasks that are in the dependency tree for do_build.
Comment 2 Paul Eggleton 2017-03-07 23:00:33 UTC
(In reply to comment #1)
> Note that this isn't just "all dependent recipes", to make this work, we
> actually have to traverse up the dependency tree and then back down it.
> 
> For example, "bitbake core-image-sato -c fetch" but when we want a
> "fetchall" task, we have to look at core-image-sato:do_build, then look for
> all fetch tasks that are in the dependency tree for do_build.

Good point - although I'd envisaged that for this mode you would invoke bitbake without specifying a target task and specify the "run all" task separately, so that the default do_build would be the target task. e.g.

bitbake --runall do_fetch core-image-minimal
Comment 3 Richard Purdie 2017-03-07 23:02:52 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Note that this isn't just "all dependent recipes", to make this work, we
> > actually have to traverse up the dependency tree and then back down it.
> > 
> > For example, "bitbake core-image-sato -c fetch" but when we want a
> > "fetchall" task, we have to look at core-image-sato:do_build, then look for
> > all fetch tasks that are in the dependency tree for do_build.
> 
> Good point - although I'd envisaged that for this mode you would invoke
> bitbake without specifying a target task and specify the "run all" task
> separately, so that the default do_build would be the target task. e.g.
> 
> bitbake --runall do_fetch core-image-minimal

Right, this is why we end up with the do_fetchall[recideptask] = "do_${BB_DEFAULT_TASK}" style lines. I just wanted to be clear about how this would need to work for anyone who hasn't gone into the details of how this needs to work before.
Comment 4 Matthew McClintock 2017-03-08 03:00:16 UTC
https://patchwork.openembedded.org/patch/137877/

The above seems to solve the issues.
Comment 5 Paul Eggleton 2017-03-20 22:58:28 UTC
Merged to master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=404f2aef94f8db6e46101e4ec9a6aa7e85b97880

Thanks Matthew!