From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Svein Seldal <sveinse@seldal.com>, yocto@yoctoproject.org
Subject: Re: Path to current bb-file or layer
Date: Fri, 22 Sep 2017 12:42:30 +0100 [thread overview]
Message-ID: <1506080550.18640.190.camel@linuxfoundation.org> (raw)
In-Reply-To: <2c36d7a5-0749-f3f8-1dd9-eff118cb9de3@seldal.com>
On Fri, 2017-09-22 at 13:04 +0200, Svein Seldal wrote:
> 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?
I suspect I'm misremembering the places that FILE gets reset in the
bitbake parser. It probably changes for conf and bb files and maybe inc
files but not bbclass files.
Why it does that is before my time with the codebase and I've never
really dared change it.
A better way to get what you're after may be to look at the contents
of BBINCLUDED.
Cheers,
Richard
next prev parent reply other threads:[~2017-09-22 11:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-22 11:04 Path to current bb-file or layer Svein Seldal
2017-09-22 11:42 ` Richard Purdie [this message]
2017-09-22 13:39 ` Svein Seldal
-- strict thread matches above, loose matches on Subject: below --
2017-09-21 20:00 Svein Seldal
2017-09-21 21:29 ` Andre McCurdy
2017-09-21 21:36 ` Richard Purdie
2017-09-22 8:17 ` Svein Seldal
2017-09-22 8:30 ` Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506080550.18640.190.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=sveinse@seldal.com \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.