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

Robert P. J. Day

On Sat, 8 Feb 2020, Jonatan Palsson wrote:

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.

# $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/
# "xxd"
# pre-expansion value:
# "${PN} xxd"
PROVIDES="vim xxd"

# $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/
# "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.
to summarize (and one last question), first, it would be utterly
superfluous for any recipe to "PROVIDES" its own exact name. i'm not
saying i've seen that in any of the OE/YP recipes, but i have taught
courses where students who have been using OE/YP have been under the
mistaken impression that they needed to do that, and were adding a
"PROVIDES = " line to every recipe file they wrote.

second, i think we all agree that it is rarely necessary to use
"PROVIDES +=", although i did run across one case in

PROVIDES = "virtual/libc"
PROVIDES += "virtual/libintl virtual/libiconv"

where, sure, if you break it over more than one line, yes, then you
need it.

and a final question ... i just noticed the line:


in a couple files:

$ grep -r "^PROVIDES = \"\"" *
meta/conf/bitbake.conf:PROVIDES = ""
meta/recipes-core/glibc/ = ""
meta/recipes-core/libxcrypt/ = ""

in that first file is the snippet:

# strip provides

i had never noticed that being done before, and the comment suggests
that this is somehow resetting or clearing the PROVIDES value. is that
what this is doing? am i misreading this?

thanks to all for assisting in my courseware cleanup. slowly but


Join to automatically receive all group messages.