From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Nithyakala Sainath <nithisai@gmail.com>
Cc: poky@yoctoproject.org
Subject: Re: Not able to set env var from anon function
Date: Fri, 10 Jul 2015 09:08:33 +0100 [thread overview]
Message-ID: <1436515713.9778.52.camel@linuxfoundation.org> (raw)
In-Reply-To: <CACj2azvy9HZUsaoJO8jPHzMMrck1t_2O-1ctAffWOT3x9F3oFw@mail.gmail.com>
On Thu, 2015-07-09 at 17:42 +0530, Nithyakala Sainath wrote:
> I was playing with environmental variables and datastore that I fell
> into this situation:
>
> In a reccipe a.bb
>
> export TEMPDIR = "temp"
>
> python() {
> os.environ["TEMPDIR"] = "randomvalue"
> }
>
> do_compile() {
> echo ${TEMPDIR }
> }
>
> gives me "temp" as the answer. I was expecting "randomvalue". Can I
> not modify the environmental variables and create new ones in anon
> functions ?
>
> But d.setVar("TEMPDIR", "randomvalue") in place of os.environ does the
> mgic. Why can't we manipulate the environmental variable using
> os.environ ?
>
> In bitbake.conf, we see that we can get env vars using os.getenv.
bitbake tightly controls the task execution environment. Only variables
marked as "export" will be exported and the value used for them is that
from the datastore. Therefore, os.environ set in anonymous python will
simply get overwritten. You can't have one value in the datastore and
another in the environment.
As Ross points out, ${TEMPDIR} will get expanded by bitbake anyway so it
would print the datastore value anyway.
Cheers,
Richard
next prev parent reply other threads:[~2015-07-10 8:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-09 12:12 Not able to set env var from anon function Nithyakala Sainath
2015-07-09 13:40 ` Burton, Ross
2015-07-10 5:21 ` Nithyakala Sainath
2015-07-10 8:08 ` Richard Purdie [this message]
2015-07-10 11:33 ` Nithyakala Sainath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436515713.9778.52.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=nithisai@gmail.com \
--cc=poky@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.