Openembedded Core Discussions
 help / color / mirror / Atom feed
* recipe using environment variable does not refresh / rebuild
@ 2018-02-01 14:46 Piotr Lewicki
  2018-02-01 14:50 ` Burton, Ross
  0 siblings, 1 reply; 4+ messages in thread
From: Piotr Lewicki @ 2018-02-01 14:46 UTC (permalink / raw)
  To: openembedded-core

Hi,

I have a problem with forcing rebuild of the recipe depending on the 
environment variable.

In my recipe I have an anonymous python function that obtains the env 
variable and depending on it sets some other internal variables (needed 
by swupdate recipe):


python() {
     origenv = d.getVar("BB_ORIGENV", False)
     u_boot_enabled = origenv.getVar("ADD_UBOOT_TO_UPDATE", False)

     if u_boot_enabled == None:
         bb.warn("Not adding u-boot to the image")
     else:
         bb.warn("Adding u-boot to the image")
         d.appendVar("SWUPDATE_IMAGES", " u-boot.imx")
         d.setVarFlag("SWUPDATE_IMAGES_NOAPPEND_MACHINE", "u-boot.imx", "1")
}


My issue is that there is no difference when I either set or unset my 
environment variable "ADD_UBOOT_TO_UPDATE".


Can you point me a solution how I could force checking this variable and 
rerunning/rebuilding the recipe?


Thanks,

Piotr



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: recipe using environment variable does not refresh / rebuild
  2018-02-01 14:46 recipe using environment variable does not refresh / rebuild Piotr Lewicki
@ 2018-02-01 14:50 ` Burton, Ross
  2018-02-01 15:00   ` Piotr Lewicki
  0 siblings, 1 reply; 4+ messages in thread
From: Burton, Ross @ 2018-02-01 14:50 UTC (permalink / raw)
  To: Piotr Lewicki; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]

On 1 February 2018 at 14:46, Piotr Lewicki <piotr.lewicki@elfin.de> wrote:

> Hi,
>
> I have a problem with forcing rebuild of the recipe depending on the
> environment variable.
>
> In my recipe I have an anonymous python function that obtains the env
> variable and depending on it sets some other internal variables (needed by
> swupdate recipe):
>
>
> python() {
>     origenv = d.getVar("BB_ORIGENV", False)
>     u_boot_enabled = origenv.getVar("ADD_UBOOT_TO_UPDATE", False)
>
>     if u_boot_enabled == None:
>         bb.warn("Not adding u-boot to the image")
>     else:
>         bb.warn("Adding u-boot to the image")
>         d.appendVar("SWUPDATE_IMAGES", " u-boot.imx")
>         d.setVarFlag("SWUPDATE_IMAGES_NOAPPEND_MACHINE", "u-boot.imx",
> "1")
> }
>
>
> My issue is that there is no difference when I either set or unset my
> environment variable "ADD_UBOOT_TO_UPDATE".
>
>
> Can you point me a solution how I could force checking this variable and
> rerunning/rebuilding the recipe?
>

Can't you use a variable set in local.conf instead?

Ross

[-- Attachment #2: Type: text/html, Size: 1625 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: recipe using environment variable does not refresh / rebuild
  2018-02-01 14:50 ` Burton, Ross
@ 2018-02-01 15:00   ` Piotr Lewicki
  2018-02-01 15:09     ` Richard Purdie
  0 siblings, 1 reply; 4+ messages in thread
From: Piotr Lewicki @ 2018-02-01 15:00 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]

Hi Ross,

Good idea, but I'm using gitlab to perform autobuilds and I want to set 
the variable there (the "ADD_UBOOT_TO_UPDATE" variable) so that it's 
propagated to the image recipe.

I'm want to differentiate the image with and without u-boot only by 
setting this one environment variable and without additional mangling 
with local.conf.


If that's not possible- I'll use your idea with setting it in 
local.conf, but before that I'm trying to understand- why my recipe is 
not rebuilt?


Thanks,

Piotr


On 01.02.2018 15:50, Burton, Ross wrote:
> On 1 February 2018 at 14:46, Piotr Lewicki <piotr.lewicki@elfin.de 
> <mailto:piotr.lewicki@elfin.de>> wrote:
>
>     Hi,
>
>     I have a problem with forcing rebuild of the recipe depending on
>     the environment variable.
>
>     In my recipe I have an anonymous python function that obtains the
>     env variable and depending on it sets some other internal
>     variables (needed by swupdate recipe):
>
>
>     python() {
>         origenv = d.getVar("BB_ORIGENV", False)
>         u_boot_enabled = origenv.getVar("ADD_UBOOT_TO_UPDATE", False)
>
>         if u_boot_enabled == None:
>             bb.warn("Not adding u-boot to the image")
>         else:
>             bb.warn("Adding u-boot to the image")
>             d.appendVar("SWUPDATE_IMAGES", " u-boot.imx")
>             d.setVarFlag("SWUPDATE_IMAGES_NOAPPEND_MACHINE",
>     "u-boot.imx", "1")
>     }
>
>
>     My issue is that there is no difference when I either set or unset
>     my environment variable "ADD_UBOOT_TO_UPDATE".
>
>
>     Can you point me a solution how I could force checking this
>     variable and rerunning/rebuilding the recipe?
>
>
> Can't you use a variable set in local.conf instead?
>
> Ross


[-- Attachment #2: Type: text/html, Size: 3267 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: recipe using environment variable does not refresh / rebuild
  2018-02-01 15:00   ` Piotr Lewicki
@ 2018-02-01 15:09     ` Richard Purdie
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2018-02-01 15:09 UTC (permalink / raw)
  To: Piotr Lewicki, Burton, Ross; +Cc: OE-core

On Thu, 2018-02-01 at 16:00 +0100, Piotr Lewicki wrote:
> Hi Ross,
> Good idea, but I'm using gitlab to perform autobuilds and I want to
> set the variable there (the "ADD_UBOOT_TO_UPDATE" variable) so that
> it's propagated to the image recipe.
> I'm want to differentiate the image with and without u-boot only by
> setting this one environment variable and without additional mangling
> with local.conf.
> 
> If that's not possible- I'll use your idea with setting it in
> local.conf, but before that I'm trying to understand- why my recipe
> is not rebuilt?

It isn't rebuilt as bitbake isn't psychic!

Bitbake doesn't understand what anonymous python fragments do, so it
can't know that ADD_UBOOT_TO_UPDATE is being changed.

I have a suspicion that it might rebuild, *if* it knew it had to
reparse the recipe since it probably does know which tasks use that
variable. It doesn't know you're poking into BB_ORIGENV which you
really shouldn't be doing.

To make this work as you'd want, you could add ADD_UBOOT_TO_UPDATE to
BB_PRESERVE_ENV. That might be enough to cause it to re-parse each time
you change the value and in turn, if the tasks change based on that,
they might rebuild. I'd at least start there (and stop poking into
BB_ORIGENV).

Cheers,

Richard




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-01 15:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-01 14:46 recipe using environment variable does not refresh / rebuild Piotr Lewicki
2018-02-01 14:50 ` Burton, Ross
2018-02-01 15:00   ` Piotr Lewicki
2018-02-01 15:09     ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox