[yocto] Path to current bb-file or layer
Svein Seldal
sveinse at seldal.com
Fri Sep 22 01:17:18 PDT 2017
On 21. sep. 2017 23:36, Richard Purdie wrote:
> You mean like ${FILE} ?
>
> $ bitbake bash -e | grep ^FILE=
> FILE="/media/build1/poky/meta/recipes-extended/bash/bash_4.4.bb"
To me ${FILE} seems to be pointing towards the receipe, and not the
current .bbclass file as you'd expect.
If I put this in local.conf
INHERIT += "sp-version"
SP_BASEVERSION = "${@read_spbaseversion(d)}"
And in sp-version.bbclass:
def read_spbaseversion(d):
bb.warn("SVEIN FILE: ", d.getVar('FILE', False))
return '0'
If I do bitbake -e, I get
WARNING: SVEIN FILE: /home/s/build-sp-image/build/conf/bblayers.conf
Later the read_spbaseversion is used from within recipe (although they
don't need to as this variable goes into the global scope, but for the
sake of the demonstration). Then the value being prined is:
WARNING: /home/s/build-sp-image/meta-sp/sp/sp.bb: SVEIN OPEN:
/home/s/build-sp-image/meta-sp/sp/sp.bb
Hence, ${FILE} seems to point to the current file scope, like a recipe,
and not any class files that the recipe might take use of.
Best regards,
Svein
More information about the yocto
mailing list