summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2012-03-23 14:30:43 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-25 12:23:30 +0100
commita18a7247698653663264ce28082205a4f7305294 (patch)
tree5c76f1dcb4638427f725308d0859c143b7d16d5f /bitbake/lib/bb/ui
parent09b16096f622feaaaccb0f14754409888f50e4db (diff)
downloadpoky-a18a7247698653663264ce28082205a4f7305294.tar.gz
Hob: Cleanup for hobeventhandler.py
(Bitbake rev: 8bd6d8bb5e5ca0ca0ea2e2d31ffdc6df1aca16a2) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py2
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py75
-rwxr-xr-xbitbake/lib/bb/ui/hob.py4
3 files changed, 34 insertions, 47 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 2fe67d9ef3..0faef9b0aa 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -409,7 +409,7 @@ class Builder(gtk.Window):
409 self.parameters.all_layers = layers 409 self.parameters.all_layers = layers
410 410
411 def handler_command_succeeded_cb(self, handler, initcmd): 411 def handler_command_succeeded_cb(self, handler, initcmd):
412 if initcmd == self.handler.LAYERS_REFRESH: 412 if initcmd == self.handler.GENERATE_CONFIGURATION:
413 self.image_configuration_page.switch_machine_combo() 413 self.image_configuration_page.switch_machine_combo()
414 elif initcmd in [self.handler.GENERATE_RECIPES, 414 elif initcmd in [self.handler.GENERATE_RECIPES,
415 self.handler.GENERATE_PACKAGES, 415 self.handler.GENERATE_PACKAGES,
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 664f866a4a..8094d2dbad 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -62,8 +62,8 @@ class HobHandler(gobject.GObject):
62 (gobject.TYPE_PYOBJECT,)), 62 (gobject.TYPE_PYOBJECT,)),
63 } 63 }
64 64
65 (CFG_AVAIL_LAYERS, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDKMACH, FILES_MATCH_CLASS, PARSE_CONFIG, GENERATE_TGTS, GENERATE_PACKAGEINFO, BUILD_TARGET_RECIPES, BUILD_TARGET_IMAGE, CMD_END) = range(12) 65 (GENERATE_CONFIGURATION, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(5)
66 (LAYERS_REFRESH, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(5) 66 (SUB_PATH_LAYERS, SUB_FILES_DISTRO, SUB_FILES_MACH, SUB_FILES_SDKMACH, SUB_MATCH_CLASS, SUB_PARSE_CONFIG, SUB_GNERATE_TGTS, SUB_GENERATE_PKGINFO, SUB_BUILD_RECIPES, SUB_BUILD_IMAGE) = range(10)
67 67
68 def __init__(self, server, recipe_model, package_model): 68 def __init__(self, server, recipe_model, package_model):
69 super(HobHandler, self).__init__() 69 super(HobHandler, self).__init__()
@@ -84,21 +84,6 @@ class HobHandler(gobject.GObject):
84 self.error_msg = "" 84 self.error_msg = ""
85 self.initcmd = None 85 self.initcmd = None
86 86
87 def kick(self):
88 import xmlrpclib
89 try:
90 # kick the while thing off
91 self.commands_async.append(self.CFG_PATH_LAYERS)
92 self.commands_async.append(self.CFG_FILES_DISTRO)
93 self.commands_async.append(self.CFG_FILES_MACH)
94 self.commands_async.append(self.CFG_FILES_SDKMACH)
95 self.commands_async.append(self.FILES_MATCH_CLASS)
96 self.run_next_command()
97 return True
98 except xmlrpclib.Fault as x:
99 print("XMLRPC Fault getting commandline:\n %s" % x)
100 return False
101
102 def set_busy(self): 87 def set_busy(self):
103 if not self.generating: 88 if not self.generating:
104 self.emit("generating-data") 89 self.emit("generating-data")
@@ -122,30 +107,28 @@ class HobHandler(gobject.GObject):
122 self.emit("command-succeeded", self.initcmd) 107 self.emit("command-succeeded", self.initcmd)
123 return 108 return
124 109
125 if next_command == self.CFG_AVAIL_LAYERS: 110 if next_command == self.SUB_PATH_LAYERS:
126 self.server.runCommand(["findCoreBaseFiles", "layers", "conf/layer.conf"])
127 elif next_command == self.CFG_PATH_LAYERS:
128 self.server.runCommand(["findConfigFilePath", "bblayers.conf"]) 111 self.server.runCommand(["findConfigFilePath", "bblayers.conf"])
129 elif next_command == self.CFG_FILES_DISTRO: 112 elif next_command == self.SUB_FILES_DISTRO:
130 self.server.runCommand(["findConfigFiles", "DISTRO"]) 113 self.server.runCommand(["findConfigFiles", "DISTRO"])
131 elif next_command == self.CFG_FILES_MACH: 114 elif next_command == self.SUB_FILES_MACH:
132 self.server.runCommand(["findConfigFiles", "MACHINE"]) 115 self.server.runCommand(["findConfigFiles", "MACHINE"])
133 elif next_command == self.CFG_FILES_SDKMACH: 116 elif next_command == self.SUB_FILES_SDKMACH:
134 self.server.runCommand(["findConfigFiles", "MACHINE-SDK"]) 117 self.server.runCommand(["findConfigFiles", "MACHINE-SDK"])
135 elif next_command == self.FILES_MATCH_CLASS: 118 elif next_command == self.SUB_MATCH_CLASS:
136 self.server.runCommand(["findFilesMatchingInDir", "rootfs_", "classes"]) 119 self.server.runCommand(["findFilesMatchingInDir", "rootfs_", "classes"])
137 elif next_command == self.PARSE_CONFIG: 120 elif next_command == self.SUB_PARSE_CONFIG:
138 self.server.runCommand(["parseConfigurationFiles", "", ""]) 121 self.server.runCommand(["parseConfigurationFiles", "", ""])
139 elif next_command == self.GENERATE_TGTS: 122 elif next_command == self.SUB_GNERATE_TGTS:
140 self.server.runCommand(["generateTargetsTree", "classes/image.bbclass", []]) 123 self.server.runCommand(["generateTargetsTree", "classes/image.bbclass", []])
141 elif next_command == self.GENERATE_PACKAGEINFO: 124 elif next_command == self.SUB_GENERATE_PKGINFO:
142 self.server.runCommand(["triggerEvent", "bb.event.RequestPackageInfo()"]) 125 self.server.runCommand(["triggerEvent", "bb.event.RequestPackageInfo()"])
143 elif next_command == self.BUILD_TARGET_RECIPES: 126 elif next_command == self.SUB_BUILD_RECIPES:
144 self.clear_busy() 127 self.clear_busy()
145 self.building = True 128 self.building = True
146 self.server.runCommand(["buildTargets", self.recipe_queue, "build"]) 129 self.server.runCommand(["buildTargets", self.recipe_queue, "build"])
147 self.recipe_queue = [] 130 self.recipe_queue = []
148 elif next_command == self.BUILD_TARGET_IMAGE: 131 elif next_command == self.SUB_BUILD_IMAGE:
149 self.clear_busy() 132 self.clear_busy()
150 self.building = True 133 self.building = True
151 targets = ["hob-image"] 134 targets = ["hob-image"]
@@ -264,14 +247,10 @@ class HobHandler(gobject.GObject):
264 self.server.runCommand(["initCooker"]) 247 self.server.runCommand(["initCooker"])
265 248
266 def refresh_layers(self, bblayers): 249 def refresh_layers(self, bblayers):
267 self.server.runCommand(["initCooker"]) 250 self.init_cooker()
268 self.server.runCommand(["setVariable", "BBLAYERS", " ".join(bblayers)]) 251 self.set_bblayers(bblayers)
269 self.commands_async.append(self.PARSE_CONFIG) 252 self.commands_async.append(self.SUB_PARSE_CONFIG)
270 self.commands_async.append(self.CFG_FILES_DISTRO) 253 self.generate_configuration()
271 self.commands_async.append(self.CFG_FILES_MACH)
272 self.commands_async.append(self.CFG_FILES_SDKMACH)
273 self.commands_async.append(self.FILES_MATCH_CLASS)
274 self.run_next_command(self.LAYERS_REFRESH)
275 254
276 def set_extra_inherit(self, bbclass): 255 def set_extra_inherit(self, bbclass):
277 inherits = self.server.runCommand(["getVariable", "INHERIT"]) or "" 256 inherits = self.server.runCommand(["getVariable", "INHERIT"]) or ""
@@ -330,27 +309,35 @@ class HobHandler(gobject.GObject):
330 self.server.runCommand(["setVariable", key, value]) 309 self.server.runCommand(["setVariable", key, value])
331 310
332 def request_package_info_async(self): 311 def request_package_info_async(self):
333 self.commands_async.append(self.GENERATE_PACKAGEINFO) 312 self.commands_async.append(self.SUB_GENERATE_PKGINFO)
334 self.run_next_command(self.POPULATE_PACKAGEINFO) 313 self.run_next_command(self.POPULATE_PACKAGEINFO)
335 314
315 def generate_configuration(self):
316 self.commands_async.append(self.SUB_PATH_LAYERS)
317 self.commands_async.append(self.SUB_FILES_DISTRO)
318 self.commands_async.append(self.SUB_FILES_MACH)
319 self.commands_async.append(self.SUB_FILES_SDKMACH)
320 self.commands_async.append(self.SUB_MATCH_CLASS)
321 self.run_next_command(self.GENERATE_CONFIGURATION)
322
336 def generate_recipes(self): 323 def generate_recipes(self):
337 self.commands_async.append(self.PARSE_CONFIG) 324 self.commands_async.append(self.SUB_PARSE_CONFIG)
338 self.commands_async.append(self.GENERATE_TGTS) 325 self.commands_async.append(self.SUB_GNERATE_TGTS)
339 self.run_next_command(self.GENERATE_RECIPES) 326 self.run_next_command(self.GENERATE_RECIPES)
340 327
341 def generate_packages(self, tgts): 328 def generate_packages(self, tgts):
342 targets = [] 329 targets = []
343 targets.extend(tgts) 330 targets.extend(tgts)
344 self.recipe_queue = targets 331 self.recipe_queue = targets
345 self.commands_async.append(self.PARSE_CONFIG) 332 self.commands_async.append(self.SUB_PARSE_CONFIG)
346 self.commands_async.append(self.BUILD_TARGET_RECIPES) 333 self.commands_async.append(self.SUB_BUILD_RECIPES)
347 self.run_next_command(self.GENERATE_PACKAGES) 334 self.run_next_command(self.GENERATE_PACKAGES)
348 335
349 def generate_image(self, tgts, toolchain_build=False): 336 def generate_image(self, tgts, toolchain_build=False):
350 self.package_queue = tgts 337 self.package_queue = tgts
351 self.toolchain_build = toolchain_build 338 self.toolchain_build = toolchain_build
352 self.commands_async.append(self.PARSE_CONFIG) 339 self.commands_async.append(self.SUB_PARSE_CONFIG)
353 self.commands_async.append(self.BUILD_TARGET_IMAGE) 340 self.commands_async.append(self.SUB_BUILD_IMAGE)
354 self.run_next_command(self.GENERATE_IMAGE) 341 self.run_next_command(self.GENERATE_IMAGE)
355 342
356 def build_failed_async(self): 343 def build_failed_async(self):
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py
index daa708b7ef..7c147c4e1b 100755
--- a/bitbake/lib/bb/ui/hob.py
+++ b/bitbake/lib/bb/ui/hob.py
@@ -56,10 +56,10 @@ def main (server = None, eventHandler = None):
56 package_model = PackageListModel() 56 package_model = PackageListModel()
57 57
58 hobHandler = HobHandler(server, recipe_model, package_model) 58 hobHandler = HobHandler(server, recipe_model, package_model)
59 if hobHandler.kick() == False:
60 return 1
61 builder = Builder(hobHandler, recipe_model, package_model) 59 builder = Builder(hobHandler, recipe_model, package_model)
62 60
61 hobHandler.generate_configuration()
62
63 # This timeout function regularly probes the event queue to find out if we 63 # This timeout function regularly probes the event queue to find out if we
64 # have any messages waiting for us. 64 # have any messages waiting for us.
65 gobject.timeout_add(10, event_handle_idle_func, eventHandler, hobHandler) 65 gobject.timeout_add(10, event_handle_idle_func, eventHandler, hobHandler)