diff mbox series

dev-manual/new-recipe.rst: replace 'bitbake -e' with 'bitbake-getvar'

Message ID fa6e98c8-8edb-d7c0-5407-b1f27ce83078@crashcourse.ca
State Under Review
Headers show
Series dev-manual/new-recipe.rst: replace 'bitbake -e' with 'bitbake-getvar' | expand

Commit Message

Robert P. J. Day Oct. 29, 2025, 10:32 a.m. UTC
Replace the legacy call to 'bitbake -e' to get the value of a recipe's
variable with the newer call to 'bitbake-getvar'.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

Comments

Quentin Schulz Oct. 29, 2025, 10:36 a.m. UTC | #1
Hi Robert,

On 10/29/25 11:29 AM, Robert P. J. Day via lists.yoctoproject.org wrote:
> 
> Replace the legacy call to 'bitbake -e' to get the value of a recipe's
> variable with the newer call to 'bitbake-getvar'.
> 

It'd be nice if we could catch all instances of `bitbake -e` we can 
replace and fix them.

documentation/kernel-dev/common.rst has one we should be able to get rid of.

Ditto for documentation/ref-manual/variables.rst (OVERRIDES) and 
documentation/dev-manual/debugging.rst.

One thing I'm not sure bitbake-getvar does is show functions? I vaguely 
remember finding something in bitbake -e output helpful for recipe 
functions, but it's been a long time :)

Anyway, this change is fine so:

Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>

Thanks!
Quentin
Robert P. J. Day Oct. 29, 2025, 10:59 a.m. UTC | #2
On Wed, 29 Oct 2025, Quentin Schulz wrote:

> Hi Robert,
>
> On 10/29/25 11:29 AM, Robert P. J. Day via lists.yoctoproject.org wrote:
> >
> > Replace the legacy call to 'bitbake -e' to get the value of a recipe's
> > variable with the newer call to 'bitbake-getvar'.
> >
>
> It'd be nice if we could catch all instances of `bitbake -e` we can replace
> and fix them.
>
> documentation/kernel-dev/common.rst has one we should be able to get rid of.
>
> Ditto for documentation/ref-manual/variables.rst (OVERRIDES) and
> documentation/dev-manual/debugging.rst.
>
> One thing I'm not sure bitbake-getvar does is show functions? I vaguely
> remember finding something in bitbake -e output helpful for recipe functions,
> but it's been a long time :)

$ bitbake-getvar -r gawk do_install

... snip ...

do_install() {
    # Export function set
    autotools_do_install
	# remove the link since we don't package it
	rm /home/rpjday/oe/builds/qemuarm64/tmp/work/cortexa57-poky-linux/gawk/5.3.2/image/usr/bin/awk
	# Strip non-reproducible build flags (containing build paths)
	sed -i -e 's|^CC.*|CC=""|g' -e 's|^CFLAGS.*|CFLAGS=""|g'
/home/rpjday/oe/builds/qemuarm64/tmp/work/cortexa57-poky-linux/gawk/5.3.2/image/usr/bin/gawkbug
}
Robert P. J. Day Oct. 29, 2025, 12:01 p.m. UTC | #3
On Wed, 29 Oct 2025, Quentin Schulz wrote:

> Hi Robert,
>
> On 10/29/25 11:29 AM, Robert P. J. Day via lists.yoctoproject.org wrote:
> >
> > Replace the legacy call to 'bitbake -e' to get the value of a recipe's
> > variable with the newer call to 'bitbake-getvar'.
> >
>
> It'd be nice if we could catch all instances of `bitbake -e` we can replace
> and fix them.
>
> documentation/kernel-dev/common.rst has one we should be able to get rid of.

  i'll send patches as i run across these -- i would not try to
automate this as i'm sure each occurrence has a specific context that
requires individual treatment.

rday
diff mbox series

Patch

diff --git a/documentation/dev-manual/new-recipe.rst b/documentation/dev-manual/new-recipe.rst
index aa4fb97a4..55099efbb 100644
--- a/documentation/dev-manual/new-recipe.rst
+++ b/documentation/dev-manual/new-recipe.rst
@@ -219,9 +219,9 @@  compilation and packaging files, and so forth.

 The path to the per-recipe temporary work directory depends on the
 context in which it is being built. The quickest way to find this path
-is to have BitBake return it by running the following::
+is to use the ``bitbake-getvar`` utility::

-   $ bitbake -e basename | grep ^WORKDIR=
+   $ bitbake-getvar -r basename WORKDIR

 As an example, assume a Source Directory
 top-level folder named ``poky``, a default :term:`Build Directory` at