Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I generate a Parsing Error in BitBake on intent?

Tags:

yocto

bitbake

I use Anonymous Python Functions in BitBake recipes to set variables during parsing. Now I wonder if I can check if a specific variable is set or not. If not, then I want to generate a BitBake Error, which stops the build process.

Pseudo code, that I want to create:

python __anonymous () {
    if d.getVar('MY_VARIABLE', True) == "":
        <BITBAKE ERROR with custom message "MY_VARIABLE not found">
}
like image 352
h0ch5tr4355 Avatar asked Oct 26 '25 16:10

h0ch5tr4355


1 Answers

You can call bb.fatal("MY_VARIABLE not set") which will print that error and abort the build by throwing an exception.

Beware that d.getVar() returns None when the variable is unset. You only get the empty string if that's your default value.

like image 137
Patrick Ohly Avatar answered Oct 29 '25 19:10

Patrick Ohly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!