All of lore.kernel.org
 help / color / mirror / Atom feed
* Trouble capturing layer revision as variable in recipe
@ 2021-08-18 19:21 Chris Laplante
  2021-08-18 22:20 ` [bitbake-devel] " Richard Purdie
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Chris Laplante @ 2021-08-18 19:21 UTC (permalink / raw)
  To: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 1777 bytes --]

Hello all,

We are on Yocto 'zeus'.

Our u-boot recipe generates a versions.txt file containing the git commit of the U-Boot source tree. It was pointed out that since recipes can patch the source, just the source commit ID isn't quite enough. So we wanted to also include the git commit of the layer housing the recipe. Call this layer "meta-our-layer".

This is the implementation we tried:

def get_layer_path(d, name):
    layer_list = (d.getVar("BBLAYERS") or "").split()
    return [os.path.abspath(l) for l in layer_list if l.endswith(name)][0]

def get_meta_our_layer_commit(d):
    import subprocess
    output = subprocess.check_output(["git", "rev-parse", "HEAD"], universal_newlines=True, cwd=d.getVar("OUR_LAYER_PATH"))
    return output.strip()

OUR_LAYER_PATH := "${@get_layer_path(d, "meta-our-layer")}"

OUR_LAYER_COMMIT = "${@get_meta_our_layer_commit(d)}"
OUR_LAYER_COMMIT[vardepvalue] = "${@get_meta_our_layer_commit(d)}"

do_deploy_append() {
    echo "meta-our-layer:${OUR_LAYER_COMMIT}" >> ${DEPLOYDIR}/versions.txt
}


However there are two problems:

  1.  Making an empty commit to meta-our-layer doesn't cause the recipe to be re-run. What's weird is that when I use 'bitbake u-boot -e', I can see that the value of  OUR_LAYER_COMMIT is indeed changing. And with bitbake-dumpsig I can see that OUR_LAYER_COMMIT is in the task deps for do_deploy.
  2.  If I build 'u-boot', then make an empty commit to meta-our-layer, and then run "bitbake-whatchanged u-boot", I get a "The metadata is not deterministic and this needs to be fixed." error.

Am I misunderstanding the purpose of vardepvalue? I thought it could be used to here to help bitbake 'see' through values that otherwise change unexpectedly.

Thanks,
Chris

[-- Attachment #2: Type: text/html, Size: 6658 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-25 15:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 19:21 Trouble capturing layer revision as variable in recipe Chris Laplante
2021-08-18 22:20 ` [bitbake-devel] " Richard Purdie
2021-08-25 15:26   ` Chris Laplante
2021-08-25 15:34     ` Richard Purdie
2021-08-19  8:02 ` Quentin Schulz
2021-08-25 15:27   ` Chris Laplante
2021-08-19  8:36 ` Enrico Scholz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.