]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
command/cooker/knotty: Fix memres handling of command environment changes
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 21 Jan 2015 10:49:01 +0000 (10:49 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 21 Jan 2015 11:35:58 +0000 (11:35 +0000)
If the environment changes, we need memory resident bitbake to adapt to those
changes. This adds in functionality to handle this alongside the configuration
option handling code. This means that the common usage:

MACHINE=X bitbake Y

now works with the memory resident server.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/command.py
lib/bb/cooker.py
lib/bb/cookerdata.py
lib/bb/ui/knotty.py

index 60f9ac08aadb2c3ee21799069e254c58559316b0..29b0a53e980d92f688dda710e7c9c71ae4a0cf42 100644 (file)
@@ -273,7 +273,8 @@ class CommandsSync:
 
     def updateConfig(self, command, params):
         options = params[0]
-        command.cooker.updateConfigOpts(options)
+        environment = params[1]
+        command.cooker.updateConfigOpts(options, environment)
 
 class CommandsAsync:
     """
index 95f65ac685b2b9276f5b121468d2cbedc360bdcb..9086f92e5cbd8c0f9fb61df0786bf9860ce21766 100644 (file)
@@ -489,9 +489,29 @@ class BBCooker:
 
         self.handleCollections( self.data.getVar("BBFILE_COLLECTIONS", True) )
 
-    def updateConfigOpts(self,options):
+    def updateConfigOpts(self, options, environment):
         for o in options:
             setattr(self.configuration, o, options[o])
+        clean = True
+        for k in bb.utils.approved_variables():
+            if k in environment and k not in self.configuration.env:
+                logger.debug(1, "Updating environment variable %s to %s" % (k, environment[k]))
+                self.configuration.env[k] = environment[k]
+                clean = False
+            if k in self.configuration.env and k not in environment:
+                logger.debug(1, "Updating environment variable %s (deleted)" % (k))
+                del self.configuration.env[k]
+                clean = False
+            if k not in self.configuration.env and k not in environment:
+                 continue
+            if environment[k] != self.configuration.env[k]:
+                logger.debug(1, "Updating environment variable %s to %s" % (k, environment[k]))
+                self.configuration.env[k] = environment[k]
+                clean = False
+        if not clean:
+            logger.debug(1, "Base environment change, triggering reparse")
+            self.baseconfig_valid = False        
+            self.reset()
 
     def runCommands(self, server, data, abort):
         """
index 2ceed2d867211697cffe7c56e686df5df9a39b67..7eae761d59ce194a9e70045e80ef657589ac25b9 100644 (file)
@@ -69,14 +69,14 @@ class ConfigParameters(object):
             if bbpkgs:
                 self.options.pkgs_to_build.extend(bbpkgs.split())
 
-    def updateToServer(self, server):
+    def updateToServer(self, server, environment):
         options = {}
         for o in ["abort", "tryaltconfigs", "force", "invalidate_stamp", 
                   "verbose", "debug", "dry_run", "dump_signatures", 
                   "debug_domains", "extra_assume_provided", "profile"]:
             options[o] = getattr(self.options, o)
 
-        ret, error = server.runCommand(["updateConfig", options])
+        ret, error = server.runCommand(["updateConfig", options, environment])
         if error:
                 raise Exception("Unable to update the server configuration with local parameters: %s" % error)
 
index 9e58b31727599fdc3a7e9859ae9f90836c26871c..ea20ddc7e0f40d471c1b56c269baeff21e111334 100644 (file)
@@ -284,7 +284,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
 
     if not params.observe_only:
         params.updateFromServer(server)
-        params.updateToServer(server)
+        params.updateToServer(server, os.environ.copy())
         cmdline = params.parseActions()
         if not cmdline:
             print("Nothing to do.  Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")