[yocto] Path to current bb-file or layer
Svein Seldal
sveinse at seldal.com
Fri Sep 22 04:04:17 PDT 2017
On 22. sep. 2017 10:30, Richard Purdie wrote:
> Its all about when your code is executed. Try putting:
>
> SP_BASEVERSION := "${@read_spbaseversion(d)}"
>
> in the bbclass file. I suspect that will give you the bbclass file
> name.
>
> By default everything is deferred expansion so your code would give you
> the final .bb as that is the context the code is run in.
In local.conf I put:
INHERIT += "sp-version"
In classes/sp-version.bbclass
def read_spbaseversion(d):
# The goal of this function is to read and
# parse a file from the layer
bb.warn("MYSELF: ", d.getVar('FILE', False))
return '0'
SP_BASEVERSION := "${@read_spbaseversion(d)}"
Then both on Krogoth and Pyro, the following command returns:
$ bitbake -e |tee var.txt |grep MYSELF
WARNING: MYSELF: /home/s/bughunt-pyro/build/conf/bblayers.conf
WARNING: MYSELF: /home/s/bughunt-pyro/build/conf/bblayers.conf
bb.warn("MYSELF: ", d.getVar('FILE', False))
Likewise:
$ bitbake -e sp-image |tee sp-image.txt |grep MYSELF
WARNING: MYSELF: /home/s/bughunt-pyro/build/conf/bblayers.conf
WARNING: MYSELF: /home/s/bughunt-pyro/build/conf/bblayers.conf
WARNING: MYSELF: /home/s/bughunt-pyro/build/conf/bblayers.conf
bb.warn("MYSELF: ", d.getVar('FILE', False))
Is there an alternative to d.getVar() to access the "other" versions of
the variable?
Best regards,
Svein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170922/b4207771/attachment.html>
More information about the yocto
mailing list