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

Robert P. J. Day rpjday at crashcourse.ca
Thu Nov 22 20:09:01 UTC 2012


On Thu, 22 Nov 2012, Chris Larson wrote:

> 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 "$@"))="

  ok, i'll check that out when i'm a bit more with it.  just to be
clear what i want again, from a *teaching* perspective, i want the
ability to easily define lists of variables, and ask for those
variables to be printed from the current environment in precisely that
order, since there might be something i'm trying to explain which
involves examining that set of variables in a particular order.

  i can think of all sorts of "groups" that would be handy to examine
uncluttered by the rest of the environment:

 * kernel selection variables
 * build destination directory names
 * current compiler optimization values

and so on.

  i'll play with the above, it might be close to what i'm after.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


More information about the bitbake-devel mailing list