Skip to contentSkip to conversation

Forcing a task to run depending on the output of a python script?

DISCUSSION Becker Béla 1 participant 2 messages May 10, 2018 – May 15, 2018

lore
Share & tools
lore
#0 lore raw

My goal is to have a fancy version string, computed from my meta layer using versions of the git describe command, to be stored in the file system, but I can't figure out how I can invalidate the cache for my recipe in order for the do_install task to fire.

Currently, I'm using an anonymous python script instide a .bbclass to set up a variable ( let's call it ${VERSION} ) using git's numerous commands. This is then inherited in a .bb file, that contains a single file for the target, under /etc with my fancy string.

When I run bitbake -e git-version, I can see that leaving a commit changes the variable, but the package isn't rebuilt, not until I force it.

So far I have tried:
-setting PV = ${VERSION}
-changing the task basehash with BB_BASEHASH_task-do_install += ${VERSION} -adding VERSION to do_install[vardeps]

Is it possible, to have this package be rebuilt when a change occurs, so the images will be rebuilt as well?

#1 lore raw

Replying to myself because I figured it out.

If you ever need such functionality, just add a git type SRC_REV pointing to your local repo with the "usehead" option set, and use AUTOREV.

e.g.

    SRC_URI = "git://${THISDIR}/../..;usehead=1;bareclone=1"
    SRCREV = "${AUTOREV}"

"${THISDIR}/../.." looks dirty, but unfortunately ${LAYERDIR} is unavailable outside layer.conf

Cheers to everyone. I hope somebody will find this useful.