From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Joshua Lock <josh@linux.intel.com>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [RFC PATCH 1/1] bitbake|cooker: save a copy of the environment when BitBake is started
Date: Fri, 22 Jul 2011 12:25:10 +0100 [thread overview]
Message-ID: <1311333910.2344.139.camel@rex> (raw)
In-Reply-To: <928870af26317fce79d38e58b590b7236557b8e1.1311287980.git.josh@linux.intel.com>
On Thu, 2011-07-21 at 15:42 -0700, Joshua Lock wrote:
> Keep a saved copy of the environment from when BitBake is launched in the
> cooker such that child processes can replicate (and/or use values from) the
> host environment, rather than the cleaned up environment that the main
> BitBake process uses.
>
> Signed-off-by: Joshua Lock <josh@linux.intel.com>
> ---
> bin/bitbake | 5 ++++-
> lib/bb/cooker.py | 7 ++++++-
> 2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/bin/bitbake b/bin/bitbake
> index 206d97b..a9dd67e 100755
> --- a/bin/bitbake
> +++ b/bin/bitbake
> @@ -197,6 +197,9 @@ Default BBFILES are the .bb files in the current directory.""")
> handler = bb.event.LogHandler()
> logger.addHandler(handler)
>
> + # Before we start modifying the environment we should take a pristine
> + # copy for possible later use
> + initialenv = os.environ.copy()
> # Clear away any spurious environment variables. But don't wipe the
> # environment totally. This is necessary to ensure the correct operation
> # of the UIs (e.g. for DISPLAY, etc.)
> @@ -207,7 +210,7 @@ Default BBFILES are the .bb files in the current directory.""")
> server.initServer()
> idle = server.getServerIdleCB()
>
> - cooker = bb.cooker.BBCooker(configuration, idle)
> + cooker = bb.cooker.BBCooker(configuration, idle, initialenv)
> cooker.parseCommandLine()
>
> server.addcooker(cooker)
> diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
> index 0326b8c..30a1039 100644
> --- a/lib/bb/cooker.py
> +++ b/lib/bb/cooker.py
> @@ -78,7 +78,7 @@ class BBCooker:
> Manages one bitbake build run
> """
>
> - def __init__(self, configuration, server_registration_cb):
> + def __init__(self, configuration, server_registration_cb, savedenv=None):
> self.status = None
> self.appendlist = {}
> self.skiplist = {}
> @@ -87,6 +87,11 @@ class BBCooker:
>
> self.configuration = configuration
>
> + # A copy of the mapping representing the environment when BitBake was
> + # launched is saved to enable child processes to use environment
> + # variables which have been cleaned from the BitBake processes env
> + self.savedenv = savedenv
> +
> self.caches_array = []
> # Currently, only Image Creator hob ui needs extra cache.
> # So, we save Extra Cache class name and container file
This looks good as a first step of this and I'm happy to merge this
patch. I'd probably go a little further and turn the above into:
self.savedenv = bb.data.init()
for k in savedenv:
self.savedenv.setVar(k, savedenv[k])
so it becomes a data store in its own right. It then just becomes a case
of obtaining that data store in the UI or task code.
Cheers,
Richard
prev parent reply other threads:[~2011-07-22 11:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-21 22:42 [RFC PATCH 0/1] Save the initial environment v2 Joshua Lock
2011-07-21 22:42 ` [RFC PATCH 1/1] bitbake|cooker: save a copy of the environment when BitBake is started Joshua Lock
2011-07-22 11:25 ` Richard Purdie [this message]
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=1311333910.2344.139.camel@rex \
--to=richard.purdie@linuxfoundation.org \
--cc=bitbake-devel@lists.openembedded.org \
--cc=josh@linux.intel.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 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.