All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard Purdie" <richard.purdie@linuxfoundation.org>
To: chris.laplante@agilent.com,
	"bitbake-devel@lists.openembedded.org"
	<bitbake-devel@lists.openembedded.org>
Subject: Re: [bitbake-devel] Trouble capturing layer revision as variable in recipe
Date: Wed, 18 Aug 2021 23:20:30 +0100	[thread overview]
Message-ID: <eb65ff99d5863afa3425269ff7e3b0d532c5fa0e.camel@linuxfoundation.org> (raw)
In-Reply-To: <DM8PR12MB5430C5689FA1BE41556758938BFF9@DM8PR12MB5430.namprd12.prod.outlook.com>

On Wed, 2021-08-18 at 19:21 +0000, Chris Laplante via lists.openembedded.org wrote:
> 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.

I suspect you need to have bitbake always reparse the recipe too. Maybe
BB_DONT_CACHE = "1" ?

Cheers,

Richard







  reply	other threads:[~2021-08-18 22:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 19:21 Trouble capturing layer revision as variable in recipe Chris Laplante
2021-08-18 22:20 ` Richard Purdie [this message]
2021-08-25 15:26   ` [bitbake-devel] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb65ff99d5863afa3425269ff7e3b0d532c5fa0e.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=chris.laplante@agilent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.