Re: clarifying "PROVIDES =" versus "PROVIDES +=" (pedantic stuff)


Jonatan PĂ„lsson
 

Hello Robert & Leon,

So I think it might be harmful to replace it with "=", as it would no
longer provide libpcre.
I had a look at the variable expansions bitbake -e. Here are two
examples. The vim recipe uses "PROVIDES = xxd" (which would cause
weird effects if = simply overwrote any existing ${PN} value), and the
libpcre2 recipe uses "PROVIDES += pcre2", as already mentioned.

vim:
# $PROVIDES [4 operations]
# set ... /poky/meta/conf/bitbake.conf:275
# ""
# _prepend ... /poky/meta/conf/bitbake.conf:276
# "${PN} "
# set ... /poky/meta/conf/documentation.conf:335
# [doc] "A list of aliases that a recipe also provides. ... SNIP ...
# set ... /poky/meta/recipes-support/vim/vim_8.2.bb:3
# "xxd"
# pre-expansion value:
# "${PN} xxd"
PROVIDES="vim xxd"

libpcre2:
# $PROVIDES [4 operations]
# set ... /poky/meta/conf/bitbake.conf:275
# ""
# _prepend ... /poky/meta/conf/bitbake.conf:276
# "${PN} "
# set ... /poky/meta/conf/documentation.conf:335
# [doc] "A list of aliases that a recipe also provides. ... SNIP ....
# append ... /poky/meta/recipes-support/libpcre/libpcre2_10.33.bb:24
# "pcre2"
# pre-expansion value:
# "${PN} pcre2"
PROVIDES="libpcre2 pcre2"

My understanding is that ${PN} is always _prepend'ed to PROVIDES, and
due to evaluation order of the different assignment operators,
_prepend will be executed *after* = and +=. This means both
assignments are "harmless". += will give you an extra space though.
See the bottom example here:
https://www.yoctoproject.org/docs/3.1/bitbake-user-manual/bitbake-user-manual.html#variable-interaction-worked-examples

Cheers,
Jonatan

Join yocto@lists.yoctoproject.org to automatically receive all group messages.