diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobeventhandler.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 67 |
1 files changed, 49 insertions, 18 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py index d10c8588dc..4897bccd26 100644 --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py | |||
@@ -52,16 +52,13 @@ class HobHandler(gobject.GObject): | |||
52 | "error" : (gobject.SIGNAL_RUN_LAST, | 52 | "error" : (gobject.SIGNAL_RUN_LAST, |
53 | gobject.TYPE_NONE, | 53 | gobject.TYPE_NONE, |
54 | (gobject.TYPE_STRING,)), | 54 | (gobject.TYPE_STRING,)), |
55 | "build-complete" : (gobject.SIGNAL_RUN_LAST, | ||
56 | gobject.TYPE_NONE, | ||
57 | ()), | ||
58 | "reload-triggered" : (gobject.SIGNAL_RUN_LAST, | 55 | "reload-triggered" : (gobject.SIGNAL_RUN_LAST, |
59 | gobject.TYPE_NONE, | 56 | gobject.TYPE_NONE, |
60 | (gobject.TYPE_STRING, | 57 | (gobject.TYPE_STRING, |
61 | gobject.TYPE_STRING)), | 58 | gobject.TYPE_STRING)), |
62 | } | 59 | } |
63 | 60 | ||
64 | (CFG_PATH_LOCAL, CFG_PATH_HOB, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDK, FILES_MATCH_CLASS, GENERATE_TGTS, REPARSE_FILES) = range(9) | 61 | (CFG_PATH_LOCAL, CFG_PATH_HOB, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDK, FILES_MATCH_CLASS, GENERATE_TGTS, REPARSE_FILES, BUILD_IMAGE) = range(10) |
65 | 62 | ||
66 | def __init__(self, taskmodel, server): | 63 | def __init__(self, taskmodel, server): |
67 | gobject.GObject.__init__(self) | 64 | gobject.GObject.__init__(self) |
@@ -111,8 +108,21 @@ class HobHandler(gobject.GObject): | |||
111 | self.generating = False | 108 | self.generating = False |
112 | self.current_command = None | 109 | self.current_command = None |
113 | elif self.current_command == self.REPARSE_FILES: | 110 | elif self.current_command == self.REPARSE_FILES: |
114 | self.current_command = self.CFG_PATH_LAYERS | 111 | if self.build_queue: |
112 | self.current_command = self.BUILD_IMAGE | ||
113 | else: | ||
114 | self.current_command = self.CFG_PATH_LAYERS | ||
115 | self.server.runCommand(["reparseFiles"]) | 115 | self.server.runCommand(["reparseFiles"]) |
116 | elif self.current_command == self.BUILD_IMAGE: | ||
117 | self.building = "image" | ||
118 | if self.generating: | ||
119 | self.emit("data-generated") | ||
120 | self.generating = False | ||
121 | bbpath = self.server.runCommand(["getVariable", "BBPATH"]) | ||
122 | bbfiles = self.server.runCommand(["getVariable", "BBFILES"]) | ||
123 | self.server.runCommand(["buildTargets", self.build_queue, "build"]) | ||
124 | self.build_queue = [] | ||
125 | self.current_command = None | ||
116 | 126 | ||
117 | def handle_event(self, event, running_build, pbar): | 127 | def handle_event(self, event, running_build, pbar): |
118 | if not event: | 128 | if not event: |
@@ -208,27 +218,48 @@ class HobHandler(gobject.GObject): | |||
208 | pmake = "-j %s" % threads | 218 | pmake = "-j %s" % threads |
209 | self.server.runCommand(["setVariable", "BB_NUMBER_THREADS", pmake]) | 219 | self.server.runCommand(["setVariable", "BB_NUMBER_THREADS", pmake]) |
210 | 220 | ||
211 | def run_build(self, tgts): | 221 | def build_image(self, image, image_path, configurator): |
212 | self.building = "image" | ||
213 | targets = [] | 222 | targets = [] |
214 | targets.append(tgts) | 223 | targets.append(image) |
215 | if self.build_toolchain and self.build_toolchain_headers: | 224 | if self.build_toolchain and self.build_toolchain_headers: |
216 | targets = ["meta-toolchain-sdk"] + targets | 225 | targets.append("meta-toolchain-sdk") |
217 | elif self.build_toolchain: | 226 | elif self.build_toolchain: |
218 | targets = ["meta-toolchain"] + targets | 227 | targets.append("meta-toolchain") |
219 | self.server.runCommand(["buildTargets", targets, "build"]) | 228 | self.build_queue = targets |
229 | |||
230 | bbpath_ok = False | ||
231 | bbpath = self.server.runCommand(["getVariable", "BBPATH"]) | ||
232 | if image_path in bbpath.split(":"): | ||
233 | bbpath_ok = True | ||
234 | |||
235 | bbfiles_ok = False | ||
236 | bbfiles = self.server.runCommand(["getVariable", "BBFILES"]).split(" ") | ||
237 | for files in bbfiles: | ||
238 | import re | ||
239 | pattern = "%s/\*.bb" % image_path | ||
240 | if re.match(pattern, files): | ||
241 | bbfiles_ok = True | ||
242 | |||
243 | if not bbpath_ok: | ||
244 | nbbp = image_path | ||
245 | else: | ||
246 | nbbp = None | ||
247 | |||
248 | if not bbfiles_ok: | ||
249 | nbbf = "%s/*.bb" % image_path | ||
250 | else: | ||
251 | nbbf = None | ||
252 | |||
253 | if not bbfiles_ok or not bbpath_ok: | ||
254 | configurator.insertTempBBPath(nbbp, nbbf) | ||
255 | |||
256 | self.current_command = self.REPARSE_FILES | ||
257 | self.run_next_command() | ||
220 | 258 | ||
221 | def build_packages(self, pkgs): | 259 | def build_packages(self, pkgs): |
222 | self.building = "packages" | 260 | self.building = "packages" |
223 | if 'meta-toolchain' in self.build_queue: | ||
224 | self.build_queue.remove('meta-toolchain') | ||
225 | pkgs.extend('meta-toolchain') | ||
226 | self.server.runCommand(["buildTargets", pkgs, "build"]) | 261 | self.server.runCommand(["buildTargets", pkgs, "build"]) |
227 | 262 | ||
228 | def build_file(self, image): | ||
229 | self.building = "image" | ||
230 | self.server.runCommand(["buildFile", image, "build"]) | ||
231 | |||
232 | def cancel_build(self, force=False): | 263 | def cancel_build(self, force=False): |
233 | if force: | 264 | if force: |
234 | # Force the cooker to stop as quickly as possible | 265 | # Force the cooker to stop as quickly as possible |