简体   繁体   中英

How to execute code for each recipe in a Bitbake function?

Basically I want to do this in a my recipe's function:

for each recipe
    print recipe.DESCRIPTION

How is this possible?

You can create a bbclass in some layer ( meta-yourlayer/classes/ ) and then add it to INHERIT in a configuration file (machine, distro, layer.conf, local.conf).

The following content might be of inspiration, not tested:

python __anonymous() {
    bb.warn(d.getVar('DESCRIPTION'))
}

though the documentation states that anonymous functions might not work, cf https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-INHERIT .

If that's the case, you should probably add a task right after do_fetch (and that might even fix the "issue" explained right after this).

Note that this makes the class inherited globally and the anonymous function is executed at parsing time. I'm not sure this actually makes any sense for you since all recipes, even those not used, will print that message.

See https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#inherit-configuration-directive .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM