[Python] Variable expansion in bitbake recipes

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    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?

    Continue reading...

Compartilhe esta Página