[OE-core] [PATCH 0/2] Extensible SDK improvements

Richard Purdie richard.purdie at linuxfoundation.org
Mon Mar 16 13:07:45 UTC 2020


Hi Andrej,

On Mon, 2020-03-09 at 09:05 +0100, Andrej Valek wrote:
> I can try to explain it in some examples.
> 
> I would like to add some extra (dynamic) variables into local.conf in
> eSDK mode. I have found, that there are 2 possibilities (in
> populate_sdk_ext.bbclass) sdk-extra.conf and sdk_extraconf.
> 
> - sdk-extra.conf
>  - You have to have handle own function to write into sdk-extra.conf. 
> I
> think, this is not the right way for me.
> - sdk_extraconf
>  - This variable is fine, but there are some restrictions. There is
> no
> easy way to add multiple variables including values.
> 
> I would like to have:
> aaa = "valueA"
> bbb = "valueB"
> in local.conf file.
> 
> 1. sdk_extraconf = 'aaa = "valueA"\nbbb = "valueB"'
>  - this will write aaa = "valueA"\nbbb = "valueB"
> 2. python copy_buildsystem_prepend() {
>   d.setVar('sdk_extraconf','aaa = "valueA"\nbbb = "valueB"')
> }
>  - This will write exactly, what you want, but you have to have an
> copy_buildsystem_prepend and mentioned all variables with values
> defined in your class/recipe.

Why do you have to set this in a copy_buildsystem_prepend ? Shouldn't
setting the variable in your distro config or class or somewhere else
work?

> 3. sdk_extraconf = "# My notes about local.conf"
>  - Yes, you can write some string into local.conf with this way.

I suspect you can also do:

sdk_extraconf () {
# My notes about local.conf
aaa = "valueA"
bbb = "valueB"
}

or something like that, I admit I've not tested it though.

> So I have founded an way, how to add multiple variables without
> explicitly specifying their values.
> 
> # format variables for sdk_extraconf
> def write_sdk_vars(d):
>   return '\n' + '\n'.join([var + ' = "' + d.getVar(var) + '"' for var
> in
> d.getVar('SDK_EXTRACONF_VARS').split()])
> 
> SDK_EXTRACONF_VARS = "aaa bbb"
> sdk_extraconf_append = " ${@write_sdk_vars(d)}"
> 
> It will do exactly what I want, but this way is little bit nasty. So
> I have created a more complex solution for community usage.
> I think, this patch adds more functionality also for other projects.
> They can add only variables into list and the class will handle all
> the
> rest.

I do see the problem with expansion. I suspect the code in
populate_sdk_ext should be:

extraconf = (d.getVar('sdk_extraconf', False) or '').strip()
instead of:
extraconf = (d.getVar('sdk_extraconf') or '').strip()

so that variables can be used as part of the expressions. It may be our
change to the defaults for getVar messed this up, or it may be we just
didn't correctly predict this problem.

> Is it enough for the explanation?

It helps, yes, thanks. What I don't want to do is add multiple
confusing mechanisms which do approximately the same thing slightly
differently. I'd much prefer one mechanism most people can use.

As such the original proposal still concerns me. I'd prefer to tweak
one of the existing ones (even merge them!) rather than add a third
slightly different one.

I do also still think some (but not all) of what you're describing
should be in your distro/classes rather than local.conf.

Is there a way we can improve the current code rather than adding more
options. Would the expansion change be enough?

Cheers,

Richard




More information about the Openembedded-core mailing list