All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Store a data object containing the initial environment v2
@ 2011-07-22 17:20 Joshua Lock
  2011-07-22 17:21 ` [PATCH 1/1] bitbake|cooker: save a copy of the environment when BitBake is started Joshua Lock
  2011-07-25 11:50 ` [PATCH 0/1] Store a data object containing the initial environment v2 Richard Purdie
  0 siblings, 2 replies; 3+ messages in thread
From: Joshua Lock @ 2011-07-22 17:20 UTC (permalink / raw)
  To: bitbake-devel

Take a copy of the environment in the bitbake entry point and pass it to the
cooker for saving in a data store.

Tested with bitbake and bitbake-layers.

Sanity prevails thanks to diligent code review.

The following changes since commit abc67ed6921c98ed581f101ec1acc589fd9ce7e9:

  bitbake/utils: Add contains helper function from lib.oe.utils (2011-07-22 12:11:01 +0100)

are available in the git repository at:
  git://github.com/incandescant/bitbake initialenv
  https://github.com/incandescant/bitbake/tree/initialenv

Joshua Lock (1):
  bitbake|cooker: save a copy of the environment when BitBake is
    started

 bin/bitbake      |    5 ++++-
 lib/bb/cooker.py |   10 +++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

-- 
1.7.6




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

* [PATCH 1/1] bitbake|cooker: save a copy of the environment when BitBake is started
  2011-07-22 17:20 [PATCH 0/1] Store a data object containing the initial environment v2 Joshua Lock
@ 2011-07-22 17:21 ` Joshua Lock
  2011-07-25 11:50 ` [PATCH 0/1] Store a data object containing the initial environment v2 Richard Purdie
  1 sibling, 0 replies; 3+ messages in thread
From: Joshua Lock @ 2011-07-22 17:21 UTC (permalink / raw)
  To: bitbake-devel

Create a data store in the cooker containing the values of the environment
from when BitBake is launched 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 |   10 +++++++++-
 2 files changed, 13 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..540cc91 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={}):
         self.status = None
         self.appendlist = {}
         self.skiplist = {}
@@ -87,6 +87,14 @@ class BBCooker:
 
         self.configuration = configuration
 
+        # Keep a datastore of the initial environment variables and their
+        # values from when BitBake was launched to enable child processes
+        # to use environment variables which have been cleaned from the
+        # BitBake processes env
+        self.savedenv = bb.data.init()
+        for k in savedenv:
+            self.savedenv.setVar(k, savedenv[k])
+
         self.caches_array = []
         # Currently, only Image Creator hob ui needs extra cache.
         # So, we save Extra Cache class name and container file
-- 
1.7.6




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

* Re: [PATCH 0/1] Store a data object containing the initial environment v2
  2011-07-22 17:20 [PATCH 0/1] Store a data object containing the initial environment v2 Joshua Lock
  2011-07-22 17:21 ` [PATCH 1/1] bitbake|cooker: save a copy of the environment when BitBake is started Joshua Lock
@ 2011-07-25 11:50 ` Richard Purdie
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2011-07-25 11:50 UTC (permalink / raw)
  To: Joshua Lock; +Cc: bitbake-devel

On Fri, 2011-07-22 at 10:20 -0700, Joshua Lock wrote:
> Take a copy of the environment in the bitbake entry point and pass it to the
> cooker for saving in a data store.
> 
> Tested with bitbake and bitbake-layers.
> 
> Sanity prevails thanks to diligent code review.
> 
> The following changes since commit abc67ed6921c98ed581f101ec1acc589fd9ce7e9:
> 
>   bitbake/utils: Add contains helper function from lib.oe.utils (2011-07-22 12:11:01 +0100)
> 
> are available in the git repository at:
>   git://github.com/incandescant/bitbake initialenv
>   https://github.com/incandescant/bitbake/tree/initialenv
> 
> Joshua Lock (1):
>   bitbake|cooker: save a copy of the environment when BitBake is
>     started

Merged to master, thanks.

Richard




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

end of thread, other threads:[~2011-07-25 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-22 17:20 [PATCH 0/1] Store a data object containing the initial environment v2 Joshua Lock
2011-07-22 17:21 ` [PATCH 1/1] bitbake|cooker: save a copy of the environment when BitBake is started Joshua Lock
2011-07-25 11:50 ` [PATCH 0/1] Store a data object containing the initial environment v2 Richard Purdie

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.