Openembedded Bitbake Development
 help / color / mirror / Atom feed
* when does ${XX} in variable names get expanded?
@ 2011-08-04  9:19 Lu, Lianhao
  2011-08-04  9:48 ` Richard Purdie
  2011-08-04 15:30 ` Khem Raj
  0 siblings, 2 replies; 3+ messages in thread
From: Lu, Lianhao @ 2011-08-04  9:19 UTC (permalink / raw)
  To: bitbake-devel@lists.openembedded.org

Hi guys,

For the following variable definition in bitbake,

VVV = "llu"
A_${VVV} = "VVV"
A_llu = "llu"

B = "${@bb.data.getVar('A_llu', d, True)}"
C := "${@bb.data.getVar('A_llu', d, True)}"

Why B is "VVV" and C is "llu" in final? I'm wondering when is the ${VVV} in the variable name of A_${VVV} expanded.

Best Regards,
-Lianhao Lu



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

* Re: when does ${XX} in variable names get expanded?
  2011-08-04  9:19 when does ${XX} in variable names get expanded? Lu, Lianhao
@ 2011-08-04  9:48 ` Richard Purdie
  2011-08-04 15:30 ` Khem Raj
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2011-08-04  9:48 UTC (permalink / raw)
  To: Lu, Lianhao; +Cc: bitbake-devel@lists.openembedded.org

On Thu, 2011-08-04 at 17:19 +0800, Lu, Lianhao wrote:
> For the following variable definition in bitbake,
> 
> VVV = "llu"
> A_${VVV} = "VVV"
> A_llu = "llu"
> 
> B = "${@bb.data.getVar('A_llu', d, True)}"
> C := "${@bb.data.getVar('A_llu', d, True)}"
> 
> Why B is "VVV" and C is "llu" in final? I'm wondering when is the ${VVV} in the variable name of A_${VVV} expanded.

During finalise() there is a call to d.expandKeys(). That call will
cause A_${VVV} to overwrite A_llu. If you look at the variable before
that you will get one value, if you look at it after that you will see
the other.

In your example above := is the immediate assignment/expansion operator,
"immediate" being the key part so finalise() hasn't happened yet.

Cheers,

Richard




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

* Re: when does ${XX} in variable names get expanded?
  2011-08-04  9:19 when does ${XX} in variable names get expanded? Lu, Lianhao
  2011-08-04  9:48 ` Richard Purdie
@ 2011-08-04 15:30 ` Khem Raj
  1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2011-08-04 15:30 UTC (permalink / raw)
  To: bitbake-devel

On 08/04/2011 02:19 AM, Lu, Lianhao wrote:
> Hi guys,
>
> For the following variable definition in bitbake,
>
> VVV = "llu"
> A_${VVV} = "VVV"
> A_llu = "llu"
>
> B = "${@bb.data.getVar('A_llu', d, True)}"
> C := "${@bb.data.getVar('A_llu', d, True)}"
>
> Why B is "VVV" and C is "llu" in final? I'm wondering when is the ${VVV} in the variable name of A_${VVV} expanded.
>

:= demands immediate expansion so any variables thats in the expression 
will be evaluated right there

where as = will be evaluated on reference and the variables it uses will 
be read/evaluated at that time.

> Best Regards,
> -Lianhao Lu
>
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel




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

end of thread, other threads:[~2011-08-04 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-04  9:19 when does ${XX} in variable names get expanded? Lu, Lianhao
2011-08-04  9:48 ` Richard Purdie
2011-08-04 15:30 ` Khem Raj

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