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

Robert P. J. Day

(currently updating my OE/YP courseware, so the first in a number of
admittedly pedantic questions about simple stuff, just to make
absolutely sure i understand things if i'm going to be explaining it
to others. if appropriate, i can submit patches to the official YP
docs if others think it's worth it and has value.)

regarding "PROVIDES =" settings in recipe files, first, each recipe
file implicitly PROVIDES its own recipe name, that much is obvious(?).
so in the simplest possible case, the recipe, say, will
always PROVIDE "fubar" and, if that's the case, there is no value in a
PROVIDES line in that recipe file. that is, it would be silly, but
harmless, for that recipe to include the line:

PROVIDES = "fubar"

next, given that implicit inclusion, the proper way to provide
another name is with "=", not "+=", yes? i ask this as there are a
number of recipe files under openembedded that do just that:

meta/recipes-support/libatomic-ops/ += "libatomics-ops"
meta/recipes-support/libpcre/ += "pcre2"
meta/recipes-support/libpcre/ += "pcre"
meta/recipes-graphics/xorg-xserver/ += "virtual/xserver"
meta/recipes-graphics/xorg-app/ += "mkfontdir"
... etc etc ...

i am *assuming* that, in the absence of a compelling reason, the use
of "+=" instead of "=" in this context is harmless, but unnecessary,

when would it not be unnecessary? sure, there are cases where a
recipe might require an .inc file which defines a PROVIDES, at which
point the .bb file might append to it. but other than cases like that
(where an earlier PROVIDES actually *needs* to be appended to), is it
safe to say that using "+=" in this context is almost always overkill?

finally, in order to clarify why someone would want to use PROVIDES,
it seems that falls into a few categories. first, to define an
alternative (generally more generic) name for a recipe, such as:

meta/recipes-support/libpcre/ += "pcre2"
meta/recipes-support/libpcre/ += "pcre"
meta/recipes-graphics/xorg-app/ += "mkfontdir"

(i guess that would also include when an older package has been
replaced by a newer equivalent alternative.)

second reason is to define virtual providers, such as:

meta/recipes-core/glibc/ += "virtual/libintl virtual/libiconv"
meta/recipes-core/newlib/ += "virtual/libc virtual/libiconv virtual/libintl"
meta/recipes-core/musl/ += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt"

third reason i can see is in meta-freescale layer, where various
target-dependent u-boot recipes all provide the more generic "u-boot":

recipes-bsp/u-boot/ += "u-boot"
recipes-bsp/u-boot/ += "u-boot"
recipes-bsp/u-boot/ += "u-boot"

the final occasion is when a recipe defines multiple output
packages, so it might contain the line:


at that point, the explanation could finish off discussing

does the above look about right? are there any subtle details of
PROVIDES missing?



Robert P. J. Day Ottawa, Ontario, CANADA


Join { to automatically receive all group messages.