Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Chris Larson <clarson@kergoth.com>
Cc: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: runqueue: Ensure task environment is correct
Date: Wed, 07 Sep 2011 22:11:19 +0100	[thread overview]
Message-ID: <1315429879.13021.23.camel@ted> (raw)
In-Reply-To: <CABcZANkp2JLJJ4G1J1dcRkNSqiEqWqnv5Qav-5F=EAzD0UxJ3w@mail.gmail.com>

On Wed, 2011-09-07 at 11:38 -0700, Chris Larson wrote:
> On Wed, Sep 7, 2011 at 10:43 AM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > This fixes two problems:
> >
> > a) Variables which were in the parent environment but not set as "export"
> >   variables in the datastore could end up in the task environment
> >
> > b) oe.environ.update() can't cope with the generator returned by
> >   bb.data.exported_vars()
> >
> > Whilst the updated code isn't as neat, it does do the expected thing,
> > sets the environment correctly and stops unwanted values leaking into
> > the task environment.
> >
> > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> >
> > diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
> > index 5a4321f..72e6845 100644
> > --- a/bitbake/lib/bb/runqueue.py
> > +++ b/bitbake/lib/bb/runqueue.py
> > @@ -1136,7 +1136,12 @@ class RunQueueExecute:
> >                 for h in self.rqdata.hash_deps:
> >                     the_data.setVar("BBHASHDEPS_%s" % h, self.rqdata.hash_deps[h])
> >
> > -                os.environ.update(bb.data.exported_vars(the_data))
> > +                # exported_vars() returns a generator which *cannot* be passed to os.environ.update()
> > +                # successfully. We also need to unset anything from the environment which shouldn't be there
> > +                exports = bb.data.exported_vars(the_data)
> > +                bb.utils.empty_environment()
> > +                for e, v in exports:
> > +                    os.environ[e] = v
> 
> os.environ.clear()
> os.environ.update(bb.data.exported_vars(the_data))

I tried this when testing and when I read os.environ back, it was not
correct. There is something odd occurring if you pass the generator into
update() directly.

Cheers,

Richard




  reply	other threads:[~2011-09-07 21:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-07 17:43 runqueue: Ensure task environment is correct Richard Purdie
2011-09-07 18:38 ` Chris Larson
2011-09-07 21:11   ` Richard Purdie [this message]
2011-09-07 21:43     ` Chris Larson
2011-09-07 22:10       ` Richard Purdie

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=1315429879.13021.23.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=clarson@kergoth.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox