summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
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:34:53 +0100
commitfa4b1fa2577fb1a8128154c2f1417df575dbb022 (patch)
treec41f59641a8e3f2239f5f449a8fd8696da1b7578 /bitbake/lib/bb
parent7cf87fc083386dc162f3573c782d77447e608a16 (diff)
downloadpoky-fa4b1fa2577fb1a8128154c2f1417df575dbb022.tar.gz
bitbake: 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. (Bitbake rev: f50df5b891bf318f12fc61c74adfcc626cc6f836) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/command.py4
-rw-r--r--bitbake/lib/bb/cooker.py2
-rw-r--r--bitbake/lib/bb/cookerdata.py21
-rw-r--r--bitbake/lib/bb/tinfoil.py5
4 files changed, 16 insertions, 16 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 916eedac19..cc6a981921 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -387,7 +387,9 @@ class CommandsAsync:
387 """ 387 """
388 prefiles = params[0] 388 prefiles = params[0]
389 postfiles = params[1] 389 postfiles = params[1]
390 command.cooker.databuilder.parseConfigurationFiles(prefiles, postfiles) 390 command.cooker.configuration.prefile = prefiles
391 command.cooker.configuration.postfile = postfiles
392 command.cooker.loadConfigurationData()
391 command.finishAsyncCommand() 393 command.finishAsyncCommand()
392 parseConfigurationFiles.needcache = False 394 parseConfigurationFiles.needcache = False
393 395
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 4c0b569439..cd9cccdfce 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -165,7 +165,7 @@ class BBCooker:
165 if not self.configuration.server_register_idlecallback: 165 if not self.configuration.server_register_idlecallback:
166 worker = True 166 worker = True
167 167
168 self.databuilder = bb.cookerdata.CookerDataBuilder(self.configuration.params, worker) 168 self.databuilder = bb.cookerdata.CookerDataBuilder(self.configuration, worker)
169 self.configuration.data = self.databuilder.data 169 self.configuration.data = self.databuilder.data
170 170
171 def enableDataTracking(self): 171 def enableDataTracking(self):
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index 2247f8d3bd..11063b4af2 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -38,7 +38,7 @@ class ConfigParameters(object):
38 self.options.pkgs_to_build = targets or [] 38 self.options.pkgs_to_build = targets or []
39 39
40 self.options.tracking = False 40 self.options.tracking = False
41 if self.options.show_environment: 41 if hasattr(self.options, "show_environment") and self.options.show_environment:
42 self.options.tracking = True 42 self.options.tracking = True
43 43
44 for key, val in self.options.__dict__.items(): 44 for key, val in self.options.__dict__.items():
@@ -125,12 +125,16 @@ class CookerConfiguration(object):
125 self.invalidate_stamp = False 125 self.invalidate_stamp = False
126 self.dump_signatures = False 126 self.dump_signatures = False
127 self.dry_run = False 127 self.dry_run = False
128 self.tracking = False
129
130 self.env = {}
128 131
129 def setConfigParameters(self, parameters): 132 def setConfigParameters(self, parameters):
130 self.params = parameters
131 for key in self.__dict__.keys(): 133 for key in self.__dict__.keys():
132 if key in parameters.options.__dict__: 134 if key in parameters.options.__dict__:
133 setattr(self, key, parameters.options.__dict__[key]) 135 setattr(self, key, parameters.options.__dict__[key])
136 self.env = parameters.environment.copy()
137 self.tracking = parameters.tracking
134 138
135 def setServerRegIdleCallback(self, srcb): 139 def setServerRegIdleCallback(self, srcb):
136 self.server_register_idlecallback = srcb 140 self.server_register_idlecallback = srcb
@@ -167,11 +171,11 @@ def findConfigFile(configfile):
167 171
168class CookerDataBuilder(object): 172class CookerDataBuilder(object):
169 173
170 def __init__(self, params, worker = False): 174 def __init__(self, cookercfg, worker = False):
171 175
172 self.prefiles = params.prefile 176 self.prefiles = cookercfg.prefile
173 self.postfiles = params.postfile 177 self.postfiles = cookercfg.postfile
174 self.tracking = params.tracking 178 self.tracking = cookercfg.tracking
175 179
176 bb.utils.set_context(bb.utils.clean_context()) 180 bb.utils.set_context(bb.utils.clean_context())
177 bb.event.set_class_handlers(bb.event.clean_class_handlers()) 181 bb.event.set_class_handlers(bb.event.clean_class_handlers())
@@ -184,9 +188,8 @@ class CookerDataBuilder(object):
184 # to use environment variables which have been cleaned from the 188 # to use environment variables which have been cleaned from the
185 # BitBake processes env 189 # BitBake processes env
186 self.savedenv = bb.data.init() 190 self.savedenv = bb.data.init()
187 savedenv = params.environment 191 for k in cookercfg.env:
188 for k in savedenv: 192 self.savedenv.setVar(k, cookercfg.env[k])
189 self.savedenv.setVar(k, savedenv[k])
190 193
191 filtered_keys = bb.utils.approved_variables() 194 filtered_keys = bb.utils.approved_variables()
192 bb.data.inheritFromOS(self.data, self.savedenv, filtered_keys) 195 bb.data.inheritFromOS(self.data, self.savedenv, filtered_keys)
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py
index c05e1465f1..45bac5edcb 100644
--- a/bitbake/lib/bb/tinfoil.py
+++ b/bitbake/lib/bb/tinfoil.py
@@ -90,11 +90,6 @@ class TinfoilConfigParameters(ConfigParameters):
90 def parseCommandLine(self): 90 def parseCommandLine(self):
91 class DummyOptions: 91 class DummyOptions:
92 def __init__(self, initial_options): 92 def __init__(self, initial_options):
93 self.show_environment = False
94 self.pkgs_to_build = []
95 self.prefile = []
96 self.postfile = []
97 self.tracking = False
98 for key, val in initial_options.items(): 93 for key, val in initial_options.items():
99 setattr(self, key, val) 94 setattr(self, key, val)
100 95