diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/runningbuild.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/runningbuild.py | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py index 4f609fc622..718f692412 100644 --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py | |||
@@ -25,12 +25,7 @@ import logging | |||
25 | import time | 25 | import time |
26 | import urllib | 26 | import urllib |
27 | import urllib2 | 27 | import urllib2 |
28 | 28 | from bb.ui.crumbs.hobcolor import HobColors | |
29 | class Colors(object): | ||
30 | OK = "#ffffff" | ||
31 | RUNNING = "#aaffaa" | ||
32 | WARNING ="#f88017" | ||
33 | ERROR = "#ffaaaa" | ||
34 | 29 | ||
35 | class RunningBuildModel (gtk.TreeStore): | 30 | class RunningBuildModel (gtk.TreeStore): |
36 | (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7) | 31 | (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7) |
@@ -58,7 +53,10 @@ class RunningBuild (gobject.GObject): | |||
58 | ()), | 53 | ()), |
59 | 'build-complete' : (gobject.SIGNAL_RUN_LAST, | 54 | 'build-complete' : (gobject.SIGNAL_RUN_LAST, |
60 | gobject.TYPE_NONE, | 55 | gobject.TYPE_NONE, |
61 | ()) | 56 | ()), |
57 | 'task-started' : (gobject.SIGNAL_RUN_LAST, | ||
58 | gobject.TYPE_NONE, | ||
59 | (gobject.TYPE_PYOBJECT,)), | ||
62 | } | 60 | } |
63 | pids_to_task = {} | 61 | pids_to_task = {} |
64 | tasks_to_iter = {} | 62 | tasks_to_iter = {} |
@@ -108,13 +106,13 @@ class RunningBuild (gobject.GObject): | |||
108 | 106 | ||
109 | if event.levelno >= logging.ERROR: | 107 | if event.levelno >= logging.ERROR: |
110 | icon = "dialog-error" | 108 | icon = "dialog-error" |
111 | color = Colors.ERROR | 109 | color = HobColors.ERROR |
112 | elif event.levelno >= logging.WARNING: | 110 | elif event.levelno >= logging.WARNING: |
113 | icon = "dialog-warning" | 111 | icon = "dialog-warning" |
114 | color = Colors.WARNING | 112 | color = HobColors.WARNING |
115 | else: | 113 | else: |
116 | icon = None | 114 | icon = None |
117 | color = Colors.OK | 115 | color = HobColors.OK |
118 | 116 | ||
119 | # if we know which package we belong to, we'll append onto its list. | 117 | # if we know which package we belong to, we'll append onto its list. |
120 | # otherwise, we'll jump to the top of the master list | 118 | # otherwise, we'll jump to the top of the master list |
@@ -152,7 +150,7 @@ class RunningBuild (gobject.GObject): | |||
152 | None, | 150 | None, |
153 | "Package: %s" % (package), | 151 | "Package: %s" % (package), |
154 | None, | 152 | None, |
155 | Colors.OK, | 153 | HobColors.OK, |
156 | 0)) | 154 | 0)) |
157 | self.tasks_to_iter[(package, None)] = parent | 155 | self.tasks_to_iter[(package, None)] = parent |
158 | 156 | ||
@@ -160,7 +158,7 @@ class RunningBuild (gobject.GObject): | |||
160 | # such. | 158 | # such. |
161 | # @todo if parent is already in error, don't mark it green | 159 | # @todo if parent is already in error, don't mark it green |
162 | self.model.set(parent, self.model.COL_ICON, "gtk-execute", | 160 | self.model.set(parent, self.model.COL_ICON, "gtk-execute", |
163 | self.model.COL_COLOR, Colors.RUNNING) | 161 | self.model.COL_COLOR, HobColors.RUNNING) |
164 | 162 | ||
165 | # Add an entry in the model for this task | 163 | # Add an entry in the model for this task |
166 | i = self.model.append (parent, (None, | 164 | i = self.model.append (parent, (None, |
@@ -168,7 +166,7 @@ class RunningBuild (gobject.GObject): | |||
168 | task, | 166 | task, |
169 | "Task: %s" % (task), | 167 | "Task: %s" % (task), |
170 | "gtk-execute", | 168 | "gtk-execute", |
171 | Colors.RUNNING, | 169 | HobColors.RUNNING, |
172 | 0)) | 170 | 0)) |
173 | 171 | ||
174 | # update the parent's active task count | 172 | # update the parent's active task count |
@@ -179,10 +177,6 @@ class RunningBuild (gobject.GObject): | |||
179 | # that we need to attach to a task. | 177 | # that we need to attach to a task. |
180 | self.tasks_to_iter[(package, task)] = i | 178 | self.tasks_to_iter[(package, task)] = i |
181 | 179 | ||
182 | # If we don't handle these the GUI does not proceed | ||
183 | elif isinstance(event, bb.build.TaskInvalid): | ||
184 | return | ||
185 | |||
186 | elif isinstance(event, bb.build.TaskBase): | 180 | elif isinstance(event, bb.build.TaskBase): |
187 | current = self.tasks_to_iter[(package, task)] | 181 | current = self.tasks_to_iter[(package, task)] |
188 | parent = self.tasks_to_iter[(package, None)] | 182 | parent = self.tasks_to_iter[(package, None)] |
@@ -194,20 +188,20 @@ class RunningBuild (gobject.GObject): | |||
194 | if isinstance(event, bb.build.TaskFailed): | 188 | if isinstance(event, bb.build.TaskFailed): |
195 | # Mark the task and parent as failed | 189 | # Mark the task and parent as failed |
196 | icon = "dialog-error" | 190 | icon = "dialog-error" |
197 | color = Colors.ERROR | 191 | color = HobColors.ERROR |
198 | 192 | ||
199 | logfile = event.logfile | 193 | logfile = event.logfile |
200 | if logfile and os.path.exists(logfile): | 194 | if logfile and os.path.exists(logfile): |
201 | with open(logfile) as f: | 195 | with open(logfile) as f: |
202 | logdata = f.read() | 196 | logdata = f.read() |
203 | self.model.append(current, ('pastebin', None, None, logdata, 'gtk-error', Colors.OK, 0)) | 197 | self.model.append(current, ('pastebin', None, None, logdata, 'gtk-error', HobColors.OK, 0)) |
204 | 198 | ||
205 | for i in (current, parent): | 199 | for i in (current, parent): |
206 | self.model.set(i, self.model.COL_ICON, icon, | 200 | self.model.set(i, self.model.COL_ICON, icon, |
207 | self.model.COL_COLOR, color) | 201 | self.model.COL_COLOR, color) |
208 | else: | 202 | else: |
209 | icon = None | 203 | icon = None |
210 | color = Colors.OK | 204 | color = HobColors.OK |
211 | 205 | ||
212 | # Mark the task as inactive | 206 | # Mark the task as inactive |
213 | self.model.set(current, self.model.COL_ICON, icon, | 207 | self.model.set(current, self.model.COL_ICON, icon, |
@@ -219,7 +213,7 @@ class RunningBuild (gobject.GObject): | |||
219 | if self.model.get(parent, self.model.COL_ICON) != 'dialog-error': | 213 | if self.model.get(parent, self.model.COL_ICON) != 'dialog-error': |
220 | self.model.set(parent, self.model.COL_ICON, icon) | 214 | self.model.set(parent, self.model.COL_ICON, icon) |
221 | if num_active == 0: | 215 | if num_active == 0: |
222 | self.model.set(parent, self.model.COL_COLOR, Colors.OK) | 216 | self.model.set(parent, self.model.COL_COLOR, HobColors.OK) |
223 | 217 | ||
224 | # Clear the iters and the pids since when the task goes away the | 218 | # Clear the iters and the pids since when the task goes away the |
225 | # pid will no longer be used for messages | 219 | # pid will no longer be used for messages |
@@ -234,8 +228,12 @@ class RunningBuild (gobject.GObject): | |||
234 | None, | 228 | None, |
235 | "Build Started (%s)" % time.strftime('%m/%d/%Y %H:%M:%S'), | 229 | "Build Started (%s)" % time.strftime('%m/%d/%Y %H:%M:%S'), |
236 | None, | 230 | None, |
237 | Colors.OK, | 231 | HobColors.OK, |
238 | 0)) | 232 | 0)) |
233 | if pbar: | ||
234 | pbar.update(0, None, bb.event.getName(event)) | ||
235 | pbar.set_title() | ||
236 | |||
239 | elif isinstance(event, bb.event.BuildCompleted): | 237 | elif isinstance(event, bb.event.BuildCompleted): |
240 | failures = int (event._failures) | 238 | failures = int (event._failures) |
241 | self.model.prepend(None, (None, | 239 | self.model.prepend(None, (None, |
@@ -243,7 +241,7 @@ class RunningBuild (gobject.GObject): | |||
243 | None, | 241 | None, |
244 | "Build Completed (%s)" % time.strftime('%m/%d/%Y %H:%M:%S'), | 242 | "Build Completed (%s)" % time.strftime('%m/%d/%Y %H:%M:%S'), |
245 | None, | 243 | None, |
246 | Colors.OK, | 244 | HobColors.OK, |
247 | 0)) | 245 | 0)) |
248 | 246 | ||
249 | # Emit the appropriate signal depending on the number of failures | 247 | # Emit the appropriate signal depending on the number of failures |
@@ -254,6 +252,8 @@ class RunningBuild (gobject.GObject): | |||
254 | # Emit a generic "build-complete" signal for things wishing to | 252 | # Emit a generic "build-complete" signal for things wishing to |
255 | # handle when the build is finished | 253 | # handle when the build is finished |
256 | self.emit("build-complete") | 254 | self.emit("build-complete") |
255 | if pbar: | ||
256 | pbar.set_text(event.msg) | ||
257 | 257 | ||
258 | elif isinstance(event, bb.command.CommandFailed): | 258 | elif isinstance(event, bb.command.CommandFailed): |
259 | if event.error.startswith("Exited with"): | 259 | if event.error.startswith("Exited with"): |
@@ -280,6 +280,15 @@ class RunningBuild (gobject.GObject): | |||
280 | pbar.update(event.current, self.progress_total) | 280 | pbar.update(event.current, self.progress_total) |
281 | elif isinstance(event, bb.event.ParseCompleted) and pbar: | 281 | elif isinstance(event, bb.event.ParseCompleted) and pbar: |
282 | pbar.hide() | 282 | pbar.hide() |
283 | #using runqueue events as many as possible to update the progress bar | ||
284 | elif isinstance(event, (bb.runqueue.runQueueTaskStarted, bb.runqueue.sceneQueueTaskStarted)): | ||
285 | message = {} | ||
286 | message["eventname"] = bb.event.getName(event) | ||
287 | num_of_completed = event.stats.completed + event.stats.failed | ||
288 | message["current"] = num_of_completed | ||
289 | message["total"] = event.stats.total | ||
290 | message["title"] = "" | ||
291 | self.emit("task-started", message) | ||
283 | 292 | ||
284 | return | 293 | return |
285 | 294 | ||