Reputation: 289
In bitbake.conf, I found the definition of BPN and PN.
But I wonder the difference between BPN and PN.
Please explain to me with example. thanks
Upvotes: 3
Views: 1195
Reputation: 863
There are docs for BPN
, PN
and P
. However, it's easier to understand by printing the environment for an example recipe. Take asio_1.20.0.bb
:
bitbake -e asio-native | grep -e "^P=" -e "^PN=" -e "BPN="
BPN = "asio"
PN = "asio-native"
P = "asio-native-1.20.0"
Using the native recipe illustrates the differences well. Both asio
and 1.20.0
are inferred from the filename (but can also be explicitly set in the recipe). native
is added as a SPECIAL_PKGSUFFIX
, because I build asio-native
. In contrast, building asio
for the target, PN
and BPN
are the same, because there's no suffix:
bitbake -e asio | grep -e "^P=" -e "^PN=" -e "BPN="
BPN = "asio"
PN = "asio"
P = "asio-1.20.0"
Upvotes: 1
Reputation: 1622
From the yoctoproject docs
BPN This variable is a version of the
PN
variable with common prefixes and suffixes removed, such as nativesdk-, -cross, -native, and multilib’s lib64- and lib32-. The exact lists of prefixes and suffixes removed are specified by the MLPREFIX and SPECIAL_PKGSUFFIX variables, respectively.
So, PN
is the full recipe name including the above mentioned prefixes and suffixes, assuming the recipe has prefixes or suffixes.
I ran into this when bitbake gave me a QA warning that I shouldn't use ${PN}
in SRC_URI, and suggested ${BPN}
instead.
I was confused, because most recipes scratch don't have suffixes or prefixes the recipe name, so PN is usually the same as BPN.
Also, note that PN
can mean recipe-name in some contexts (in a recipe), and package-name in other contexts.
The P
= ${PN}-${PV}
confusion in the AI answer is actually correct. See the docs.
The original value for PV is extracted from the recipe name, but in practice I have often seen it set explicitly in the recipe, especially with Git and SRCREV = ${AUTOREV} and SRCPV.
Update: See the answer from @Mo_. Empirical evidence is best! I confused myself between reading the docs and other answers. I edited my answer to remove incorrect details about PN having version information.
And example that shows a difference between P
, PN
, and BPN
:
$ bitbake -e binutils-cross-aarch64 |grep -e "^PN=" -e "^P=" -e "^BPN="
BPN="binutils"
PN="binutils-cross-aarch64"
P="binutils-cross-aarch64-2.40"
Upvotes: 1