bb.utils.contains yocto

bb.utils.contains  is most commonly used function in Yocto.

grep in poky directory returned with 696 count.

$ grep -nr 'bb.utils.contains' poky/ | wc -l
696

It's definition is present in 'poky/bitbake/lib/bb/utils.py' file


This function returns third argument if the second argument is subset of the first argument else returns fourth argument

Let's take an example to understand this.


You can see from the above screenshot, when the second argument is a subset of first argument, "present" was returned, else "notpresent" was returned

We can also use bb.utils.contains inside if loop. This we can use inside a recipe.

if ${@bb.utils.contains('SOMEFLAG','NEWVALUE3','true','false',d)}; then
    FOO = 'HELLO'
fi

Comments

  1. The above conditional statement do not work out side the do_install. I have a problem where i need to decide the SRC_URI (path_ based a condition. I tried to use the if-else statement but it does not work as it give unparsed line error.

    ReplyDelete
  2. Hey!Amazing work. With full of knowledge. Our Team resolve any glitches occurring while utilizing the software. Looking for solution of Quickbooks Error 1712 Contact us +1 877 751-0742 .Our experts will assist you to fulfil your accounting needs. The solutions are accurate and time-saving.

    ReplyDelete

Post a Comment

Popular posts from this blog

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto