aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-24 09:27:25 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-24 10:33:56 +0100
commitf50df5b891bf318f12fc61c74adfcc626cc6f836 (patch)
treee4176bbe71864fbe5590647fe125be554394d562
parente493fe8cb4953935f01361ffc0240e5818ebb283 (diff)
downloadbitbake-contrib-f50df5b891bf318f12fc61c74adfcc626cc6f836.tar.gz
cooker/cookerdata: Improve configuration object handling
Originally it seemed like a good idea to keep the parameters around. Having seen this in real life use, its incorrect, we should pull all the data we need into the cooker's configuguration and then use this to build the datastore. Being able to just build the datastore from the parameters seemed like a good idea but having a dummy cooker configuration object is now looking like the better option. This also fixes failures in hob since the parseFiles command can call into cooker directly now and reset the configuration prefiles and postfiles at will, rather than the indirect calls before which were breaking the datastore (e.g. BBPATH wasn't set). The cleanup this allows in tinfoil illustrates how this change makes more sense. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/command.py4
-rw-r--r--lib/bb/cooker.py2
-rw-r--r--lib/bb/cookerdata.py21
-rw-r--r--lib/bb/tinfoil.py5
4 files changed, 16 insertions, 16 deletions
diff --git a/lib/bb/command.py b/lib/bb/command.py
index 916eedac1..cc6a98192 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -387,7 +387,9 @@ class CommandsAsync:
"""
prefiles = params[0]
postfiles = params[1]
- command.cooker.databuilder.parseConfigurationFiles(prefiles, postfiles)
+ command.cooker.configuration.prefile = prefiles
+ command.cooker.configuration.postfile = postfiles
+ command.cooker.loadConfigurationData()
command.finishAsyncCommand()
parseConfigurationFiles.needcache = False
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 4c0b56943..cd9cccdfc 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -165,7 +165,7 @@ class BBCooker:
if not self.configuration.server_register_idlecallback:
worker = True
- self.databuilder = bb.cookerdata.CookerDataBuilder(self.configuration.params, worker)
+ self.databuilder = bb.cookerdata.CookerDataBuilder(self.configuration, worker)
self.configuration.data = self.databuilder.data
def enableDataTracking(self):
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index 2247f8d3b..11063b4af 100644
--- a/lib/bb/cookerdata.py
+++ b/lib/bb/cookerdata.py
@@ -38,7 +38,7 @@ class ConfigParameters(object):
self.options.pkgs_to_build = targets or []
self.options.tracking = False
- if self.options.show_environment:
+ if hasattr(self.options, "show_environment") and self.options.show_environment:
self.options.tracking = True
for key, val in self.options.__dict__.items():
@@ -125,12 +125,16 @@ class CookerConfiguration(object):
self.invalidate_stamp = False
self.dump_signatures = False
self.dry_run = False
+ self.tracking = False
+
+ self.env = {}
def setConfigParameters(self, parameters):
- self.params = parameters
for key in self.__dict__.keys():
if key in parameters.options.__dict__:
setattr(self, key, parameters.options.__dict__[key])
+ self.env = parameters.environment.copy()
+ self.tracking = parameters.tracking
def setServerRegIdleCallback(self, srcb):
self.server_register_idlecallback = srcb
@@ -167,11 +171,11 @@ def findConfigFile(configfile):
class CookerDataBuilder(object):
- def __init__(self, params, worker = False):
+ def __init__(self, cookercfg, worker = False):
- self.prefiles = params.prefile
- self.postfiles = params.postfile
- self.tracking = params.tracking
+ self.prefiles = cookercfg.prefile
+ self.postfiles = cookercfg.postfile
+ self.tracking = cookercfg.tracking
bb.utils.set_context(bb.utils.clean_context())
bb.event.set_class_handlers(bb.event.clean_class_handlers())
@@ -184,9 +188,8 @@ class CookerDataBuilder(object):
# to use environment variables which have been cleaned from the
# BitBake processes env
self.savedenv = bb.data.init()
- savedenv = params.environment
- for k in savedenv:
- self.savedenv.setVar(k, savedenv[k])
+ for k in cookercfg.env:
+ self.savedenv.setVar(k, cookercfg.env[k])
filtered_keys = bb.utils.approved_variables()
bb.data.inheritFromOS(self.data, self.savedenv, filtered_keys)
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index c05e1465f..45bac5edc 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -90,11 +90,6 @@ class TinfoilConfigParameters(ConfigParameters):
def parseCommandLine(self):
class DummyOptions:
def __init__(self, initial_options):
- self.show_environment = False
- self.pkgs_to_build = []
- self.prefile = []
- self.postfile = []
- self.tracking = False
for key, val in initial_options.items():
setattr(self, key, val)