'Variable expansion in bitbake recipes

folks.

I've been studying yocto building process and I noticed the usage of the following structure:

PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"

I know that ${} means variable expansion and grep command showed that the function "vars_from_file" is located at bitbake/lib/bb/parse/__init__.py.

I would like to understand how this variable expansion works, so I explored bitbake files and found out that:

  • oe-init-build-env calls oe-buildenv-internal, and the last one sets PYTHONPATH to bitbake/lib.

  • I'm infering that bitbake uses PYTHONPATH to search for the function vars_from_file

What I have not understood are:

  • the meaning of the symbol "@" in the variable expansion;
  • if bitbake uses PYTHONPATH to search for the function, why did not pass the absolute path ${@bb.parse.__init__.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'} instead of "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
  • Is this type of variable expansion applied only in bitbake?. I searched in gnu website, and there is not the application of "@" in the beginning of the structures.

Can someone help me understand them?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source