summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-21 10:49:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-01-21 14:37:39 +0000
commitdb45ddeeaf3c6c598f4a8ca67730e662d4e22232 (patch)
treef1cc523a862d2e4c88cb36a52fc01fd9c105e4c5 /bitbake
parent3e4d84aea3623d4eac2e5a094cf103b26859a6b6 (diff)
downloadpoky-db45ddeeaf3c6c598f4a8ca67730e662d4e22232.tar.gz
bitbake: command/cooker/knotty: Fix memres handling of command environment changes
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. (Bitbake rev: 4d1343010da757a0c126bc22475354da44aaf8e3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/command.py3
-rw-r--r--bitbake/lib/bb/cooker.py22
-rw-r--r--bitbake/lib/bb/cookerdata.py4
-rw-r--r--bitbake/lib/bb/ui/knotty.py2
4 files changed, 26 insertions, 5 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 60f9ac08aa..29b0a53e98 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -273,7 +273,8 @@ class CommandsSync:
273 273
274 def updateConfig(self, command, params): 274 def updateConfig(self, command, params):
275 options = params[0] 275 options = params[0]
276 command.cooker.updateConfigOpts(options) 276 environment = params[1]
277 command.cooker.updateConfigOpts(options, environment)
277 278
278class CommandsAsync: 279class CommandsAsync:
279 """ 280 """
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 95f65ac685..9086f92e5c 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -489,9 +489,29 @@ class BBCooker:
489 489
490 self.handleCollections( self.data.getVar("BBFILE_COLLECTIONS", True) ) 490 self.handleCollections( self.data.getVar("BBFILE_COLLECTIONS", True) )
491 491
492 def updateConfigOpts(self,options): 492 def updateConfigOpts(self, options, environment):
493 for o in options: 493 for o in options:
494 setattr(self.configuration, o, options[o]) 494 setattr(self.configuration, o, options[o])
495 clean = True
496 for k in bb.utils.approved_variables():
497 if k in environment and k not in self.configuration.env:
498 logger.debug(1, "Updating environment variable %s to %s" % (k, environment[k]))
499 self.configuration.env[k] = environment[k]
500 clean = False
501 if k in self.configuration.env and k not in environment:
502 logger.debug(1, "Updating environment variable %s (deleted)" % (k))
503 del self.configuration.env[k]
504 clean = False
505 if k not in self.configuration.env and k not in environment:
506 continue
507 if environment[k] != self.configuration.env[k]:
508 logger.debug(1, "Updating environment variable %s to %s" % (k, environment[k]))
509 self.configuration.env[k] = environment[k]
510 clean = False
511 if not clean:
512 logger.debug(1, "Base environment change, triggering reparse")
513 self.baseconfig_valid = False
514 self.reset()
495 515
496 def runCommands(self, server, data, abort): 516 def runCommands(self, server, data, abort):
497 """ 517 """
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index 2ceed2d867..7eae761d59 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -69,14 +69,14 @@ class ConfigParameters(object):
69 if bbpkgs: 69 if bbpkgs:
70 self.options.pkgs_to_build.extend(bbpkgs.split()) 70 self.options.pkgs_to_build.extend(bbpkgs.split())
71 71
72 def updateToServer(self, server): 72 def updateToServer(self, server, environment):
73 options = {} 73 options = {}
74 for o in ["abort", "tryaltconfigs", "force", "invalidate_stamp", 74 for o in ["abort", "tryaltconfigs", "force", "invalidate_stamp",
75 "verbose", "debug", "dry_run", "dump_signatures", 75 "verbose", "debug", "dry_run", "dump_signatures",
76 "debug_domains", "extra_assume_provided", "profile"]: 76 "debug_domains", "extra_assume_provided", "profile"]:
77 options[o] = getattr(self.options, o) 77 options[o] = getattr(self.options, o)
78 78
79 ret, error = server.runCommand(["updateConfig", options]) 79 ret, error = server.runCommand(["updateConfig", options, environment])
80 if error: 80 if error:
81 raise Exception("Unable to update the server configuration with local parameters: %s" % error) 81 raise Exception("Unable to update the server configuration with local parameters: %s" % error)
82 82
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 9e58b31727..ea20ddc7e0 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -284,7 +284,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
284 284
285 if not params.observe_only: 285 if not params.observe_only:
286 params.updateFromServer(server) 286 params.updateFromServer(server)
287 params.updateToServer(server) 287 params.updateToServer(server, os.environ.copy())
288 cmdline = params.parseActions() 288 cmdline = params.parseActions()
289 if not cmdline: 289 if not cmdline:
290 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") 290 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")