[yocto] Path to current bb-file or layer

Andre McCurdy armccurdy at gmail.com
Thu Sep 21 14:29:22 PDT 2017


On Thu, Sep 21, 2017 at 1:00 PM, Svein Seldal <sveinse at seldal.com> wrote:
>
> To determine a image version, I'd like to read a VERSION file which is
> located in the root of the layer. (Per our development procedure.) I'd like
> to read it from a bbclass file. However I seem to be unable to find any
> methods or variables to find a useful path to either the current bb-file or
> the root of the layer.
>
> The only way I have found is to parse through BBLAYERS and guess at what my
> own layer is of those, and then use the found to access the file. But this
> feels very wacky.
>
> Is there a reason why bitbake doesn't have a variable path reference to the
> current file?

Doesn't FILE give you exactly that?

  http://www.yoctoproject.org/docs/2.3/bitbake-user-manual/bitbake-user-manual.html#var-FILE

You can derive from it using python, e.g.

  MYFILE := "${@os.path.abspath(os.path.dirname(d.getVar('FILE')) +
'/../../myfile.txt')}"

If you want to construct paths relative to the top level meta layers
then COREBASE might be useful too.

>
> Best regards,
> Svein
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto



More information about the yocto mailing list