summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-20 22:54:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-22 12:10:13 +0100
commitf0930c8d63cc9fd8ead759b3230ab708fffa6ed4 (patch)
treed589dce4ac5f1fb34ee6d21fc9889a9d6a48b81d /bitbake/lib/bb/cooker.py
parentf242f5060bbc62815b6d5a245c1a9bf18f23675f (diff)
downloadpoky-f0930c8d63cc9fd8ead759b3230ab708fffa6ed4.tar.gz
bitbake: cooker: Move commandline parsing back into the UI/cookerdata
Building up a set of actions for the server is tricky since we depend upon the commandline but fall back to values from the datastore. We should be able to build a datastore without a commandline and vice versa. Ultimately the UI should send the commands to the server. This patch amounts to code rearranging, moving the heavy lifting to the UI, though a helper in the configuration option. This will need further cleanup/tweaking but this should be the only update needed to the UIs. The code now queries the server for any missing data should it need to. This code allows various knowledge of configuration variables to move to the UI side only, partcularly pkgs_to_build but also all the command specifiers. It should also be possible to move cmd eventually, I'm just unsure if any callers call the commands expecting this to default to something sane right now. (Bitbake rev: 2dbbb1d51dafd4451fef8fe16f095bcd4b8f1177) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py47
1 files changed, 1 insertions, 46 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 1a2c01639e..ca544558f0 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -147,10 +147,6 @@ class BBCooker:
147 if not self.lock: 147 if not self.lock:
148 bb.fatal("Only one copy of bitbake should be run against a build directory") 148 bb.fatal("Only one copy of bitbake should be run against a build directory")
149 149
150 bbpkgs = self.configuration.data.getVar('BBPKGS', True)
151 if bbpkgs and len(self.configuration.pkgs_to_build) == 0:
152 self.configuration.pkgs_to_build.extend(bbpkgs.split())
153
154 # 150 #
155 # Special updated configuration we use for firing events 151 # Special updated configuration we use for firing events
156 # 152 #
@@ -175,7 +171,7 @@ class BBCooker:
175 171
176 def initConfigurationData(self): 172 def initConfigurationData(self):
177 self.configuration.data = bb.data.init() 173 self.configuration.data = bb.data.init()
178 if self.configuration.show_environment: 174 if self.configuration.tracking:
179 self.configuration.data.enableTracking() 175 self.configuration.data.enableTracking()
180 176
181 if not self.configuration.server_register_idlecallback: 177 if not self.configuration.server_register_idlecallback:
@@ -203,9 +199,6 @@ class BBCooker:
203 logger.exception("Error parsing configuration files") 199 logger.exception("Error parsing configuration files")
204 sys.exit(1) 200 sys.exit(1)
205 201
206 if not self.configuration.cmd:
207 self.configuration.cmd = self.configuration.data.getVar("BB_DEFAULT_TASK", True) or "build"
208
209 def saveConfigurationVar(self, var, val, default_file): 202 def saveConfigurationVar(self, var, val, default_file):
210 203
211 replaced = False 204 replaced = False
@@ -309,44 +302,6 @@ class BBCooker:
309 302
310 self.handleCollections( self.configuration.data.getVar("BBFILE_COLLECTIONS", True) ) 303 self.handleCollections( self.configuration.data.getVar("BBFILE_COLLECTIONS", True) )
311 304
312 def parseCommandLine(self):
313 # Parse any commandline into actions
314 self.commandlineAction = {'action':None, 'msg':None}
315 if self.configuration.show_environment:
316 if 'world' in self.configuration.pkgs_to_build:
317 self.commandlineAction['msg'] = "'world' is not a valid target for --environment."
318 elif 'universe' in self.configuration.pkgs_to_build:
319 self.commandlineAction['msg'] = "'universe' is not a valid target for --environment."
320 elif len(self.configuration.pkgs_to_build) > 1:
321 self.commandlineAction['msg'] = "Only one target can be used with the --environment option."
322 elif self.configuration.buildfile and len(self.configuration.pkgs_to_build) > 0:
323 self.commandlineAction['msg'] = "No target should be used with the --environment and --buildfile options."
324 elif len(self.configuration.pkgs_to_build) > 0:
325 self.commandlineAction['action'] = ["showEnvironmentTarget", self.configuration.pkgs_to_build]
326 self.configuration.data.setVar("BB_CONSOLELOG", None)
327 else:
328 self.commandlineAction['action'] = ["showEnvironment", self.configuration.buildfile]
329 self.configuration.data.setVar("BB_CONSOLELOG", None)
330 elif self.configuration.buildfile is not None:
331 self.commandlineAction['action'] = ["buildFile", self.configuration.buildfile, self.configuration.cmd]
332 elif self.configuration.revisions_changed:
333 self.commandlineAction['action'] = ["compareRevisions"]
334 elif self.configuration.show_versions:
335 self.commandlineAction['action'] = ["showVersions"]
336 elif self.configuration.parse_only:
337 self.commandlineAction['action'] = ["parseFiles"]
338 elif self.configuration.dot_graph:
339 if self.configuration.pkgs_to_build:
340 self.commandlineAction['action'] = ["generateDotGraph", self.configuration.pkgs_to_build, self.configuration.cmd]
341 else:
342 self.commandlineAction['msg'] = "Please specify a package name for dependency graph generation."
343 else:
344 if self.configuration.pkgs_to_build:
345 self.commandlineAction['action'] = ["buildTargets", self.configuration.pkgs_to_build, self.configuration.cmd]
346 else:
347 #self.commandlineAction['msg'] = "Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information."
348 self.commandlineAction = None
349
350 def runCommands(self, server, data, abort): 305 def runCommands(self, server, data, abort):
351 """ 306 """
352 Run any queued asynchronous command 307 Run any queued asynchronous command