[bitbake-devel] how easy to extend "bitbake -e" to print *selected* subset of variables?

Chris Larson clarson at kergoth.com
Thu Nov 22 19:54:07 UTC 2012


On Thu, Nov 22, 2012 at 12:00 PM, Robert P. J. Day <rpjday at crashcourse.ca>wrote:

>   i would find it *massively* useful to have a variation of "bitbake
> -e" print only the values of the variables that i'm interested in;
> this would be incredibly useful in a classroom if i wanted students to
> take a look at just those variables related to, say, the kernel.
>
>   rather than having to hack up something using grep, it would be nice
> if a user could, say, define an extra variable or class and say
> something like:
>
>   $ bitbake -e core-image-minimal --area kernel  (or similar)
>
> where i could define that the "kernel area" represents the variables
> such as MACHINE, KMACHINE, KBRANCH, LINUX_KERNEL_TYPE and whatever
> variables i decide should belong to that "area."  then when i'm
> discussing the kernel, i have a simple command that immediately allows
> the students to see how the kernel was configured.
>
>   i realize this can't be hard -- just add some filtering code to that
> part of bitbake that prints everything.  thoughts?  is there a way to
> do this that i'm not seeing?
>

I would personally like to see something like:

bitbake -E MACHINE,DISTRO,TMPDIR

Rather than having to define additional 'grouping' metadata.

For now, something like this might be convenient:

$ cat ~/bin/bitbake-env
#!/bin/sh
#
# bitbake-env VARIABLE [VARIBLE...]
#
# Filter out particular variables from bitbake -e, including the commented
out
# unexpanded form, and both exported and unexported.

args_pattern () {
    for arg; do
        printf "$arg|"
    done | sed 's,|$,,'
}

bitbake -e | grep -E "^((export )?|(# )?)($(args_pattern "$@"))="
-- 
Christopher Larson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20121122/5350d25e/attachment-0001.html>


More information about the bitbake-devel mailing list