[yocto] Ordering of anonymous Python functions and task signature calculations

Matt Hoosier matt.hoosier at gmail.com
Tue Jan 24 09:55:24 PST 2017


In order to support a use-case that embeds information about the Git
revision of Yocto itself that was used to make a build, I would like to run
some arbitrary Python code and dump the results (Git SHA1's, tag names,
etc) into a Bitbake variable.

The idea is that the variable would get consumed in a do_install() task to
populate some cookie-crumb file in the package payload.

Something like:

  DEPENDS = "git-native"

  python () {
    # This pseudocode isn't strictly functional for invoking Git, but you
get the idea
    d.setVar('GIT_INFO', subprocess.Popen(['git', 'rev-list',
...]).communicate().stdout)
  }

  do_install () {
    install -d ${D}/etc
    echo "${GIT_INFO}" > ${D}/etc/git-info.txt
  }

This all works on a fresh run, but Bitbake appears not to be evaluating the
anonymous Python function on each execution. This leads it to have
out-of-date information about the Git working copy when global state
changes but happens not to impact the particular recipe holding this logic.

Is there any trick available to cause the Python function to execute (and
hence update the value of ${GIT_INFO} each Bitbake execution so that the
up-to-the-moment contents of it filter into the calculation of the
signature for do_install()? Or am I just trying a wrong-headed approach and
doing something illegitimate?

-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170124/68d4e5dc/attachment.html>


More information about the yocto mailing list