diff options
author | Liming An <limingx.l.an@intel.com> | 2012-08-02 19:06:01 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-02 17:05:06 +0100 |
commit | 94e2a104ece703d8fa6046ea0fcf9a51ae1930e3 (patch) | |
tree | 33845eb0bc89d506e8e451a93f720f483a4a8993 /bitbake/lib/bb/ui/crumbs/runningbuild.py | |
parent | 5d952ba4a00f14f005706e3c70a98f5f8cf6ab0f (diff) | |
download | poky-94e2a104ece703d8fa6046ea0fcf9a51ae1930e3.tar.gz |
bitbake: Hob: log for Hob and allow users to show logs after successful build
If users build images in Hob, record logs and allow users to retrieve the lo
after successful build.
The logs are generated if and only if:
- users do "just bake"
- users do "build image" after "build packages"
- users do "build packages" only
[YOCTO #1991]
(Bitbake rev: 291289787bb042b99f0599babc2d67c220aadb87)
Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Liming An <limingx.l.an@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/runningbuild.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/runningbuild.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py index 0347058d7e..a57d6db5e5 100644 --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py | |||
@@ -88,6 +88,9 @@ class RunningBuild (gobject.GObject): | |||
88 | 'no-provider' : (gobject.SIGNAL_RUN_LAST, | 88 | 'no-provider' : (gobject.SIGNAL_RUN_LAST, |
89 | gobject.TYPE_NONE, | 89 | gobject.TYPE_NONE, |
90 | (gobject.TYPE_PYOBJECT,)), | 90 | (gobject.TYPE_PYOBJECT,)), |
91 | 'log' : (gobject.SIGNAL_RUN_LAST, | ||
92 | gobject.TYPE_NONE, | ||
93 | (gobject.TYPE_STRING, gobject.TYPE_PYOBJECT,)), | ||
91 | } | 94 | } |
92 | pids_to_task = {} | 95 | pids_to_task = {} |
93 | tasks_to_iter = {} | 96 | tasks_to_iter = {} |
@@ -126,6 +129,8 @@ class RunningBuild (gobject.GObject): | |||
126 | parent = self.tasks_to_iter[(package, task)] | 129 | parent = self.tasks_to_iter[(package, task)] |
127 | 130 | ||
128 | if(isinstance(event, logging.LogRecord)): | 131 | if(isinstance(event, logging.LogRecord)): |
132 | if event.taskpid == 0 or event.levelno > logging.INFO: | ||
133 | self.emit("log", "handle", event) | ||
129 | # FIXME: this is a hack! More info in Yocto #1433 | 134 | # FIXME: this is a hack! More info in Yocto #1433 |
130 | # http://bugzilla.pokylinux.org/show_bug.cgi?id=1433, temporarily | 135 | # http://bugzilla.pokylinux.org/show_bug.cgi?id=1433, temporarily |
131 | # mask the error message as it's not informative for the user. | 136 | # mask the error message as it's not informative for the user. |
@@ -211,6 +216,7 @@ class RunningBuild (gobject.GObject): | |||
211 | self.tasks_to_iter[(package, task)] = i | 216 | self.tasks_to_iter[(package, task)] = i |
212 | 217 | ||
213 | elif isinstance(event, bb.build.TaskBase): | 218 | elif isinstance(event, bb.build.TaskBase): |
219 | self.emit("log", "info", event._message) | ||
214 | current = self.tasks_to_iter[(package, task)] | 220 | current = self.tasks_to_iter[(package, task)] |
215 | parent = self.tasks_to_iter[(package, None)] | 221 | parent = self.tasks_to_iter[(package, None)] |
216 | 222 | ||
@@ -296,6 +302,7 @@ class RunningBuild (gobject.GObject): | |||
296 | self.buildaborted = True | 302 | self.buildaborted = True |
297 | 303 | ||
298 | elif isinstance(event, bb.command.CommandFailed): | 304 | elif isinstance(event, bb.command.CommandFailed): |
305 | self.emit("log", "error", "Command execution failed: %s" % (event.error)) | ||
299 | if event.error.startswith("Exited with"): | 306 | if event.error.startswith("Exited with"): |
300 | # If the command fails with an exit code we're done, emit the | 307 | # If the command fails with an exit code we're done, emit the |
301 | # generic signal for the UI to notify the user | 308 | # generic signal for the UI to notify the user |
@@ -323,7 +330,24 @@ class RunningBuild (gobject.GObject): | |||
323 | elif isinstance(event, bb.event.ParseCompleted) and pbar: | 330 | elif isinstance(event, bb.event.ParseCompleted) and pbar: |
324 | pbar.hide() | 331 | pbar.hide() |
325 | #using runqueue events as many as possible to update the progress bar | 332 | #using runqueue events as many as possible to update the progress bar |
333 | elif isinstance(event, bb.runqueue.runQueueTaskFailed): | ||
334 | self.emit("log", "error", "Task %s (%s) failed with exit code '%s'" % (event.taskid, event.taskstring, event.exitcode)) | ||
335 | elif isinstance(event, bb.runqueue.sceneQueueTaskFailed): | ||
336 | self.emit("log", "warn", "Setscene task %s (%s) failed with exit code '%s' - real task will be run instead" \ | ||
337 | % (event.taskid, event.taskstring, event.exitcode)) | ||
326 | elif isinstance(event, (bb.runqueue.runQueueTaskStarted, bb.runqueue.sceneQueueTaskStarted)): | 338 | elif isinstance(event, (bb.runqueue.runQueueTaskStarted, bb.runqueue.sceneQueueTaskStarted)): |
339 | if isinstance(event, bb.runqueue.sceneQueueTaskStarted): | ||
340 | self.emit("log", "info", "Running setscene task %d of %d (%s)" % \ | ||
341 | (event.stats.completed + event.stats.active + event.stats.failed + 1, | ||
342 | event.stats.total, event.taskstring)) | ||
343 | else: | ||
344 | if event.noexec: | ||
345 | tasktype = 'noexec task' | ||
346 | else: | ||
347 | tasktype = 'task' | ||
348 | self.emit("log", "info", "Running %s %s of %s (ID: %s, %s)" % \ | ||
349 | (tasktype, event.stats.completed + event.stats.active + event.stats.failed + 1, | ||
350 | event.stats.total, event.taskid, event.taskstring)) | ||
327 | message = {} | 351 | message = {} |
328 | message["eventname"] = bb.event.getName(event) | 352 | message["eventname"] = bb.event.getName(event) |
329 | num_of_completed = event.stats.completed + event.stats.failed | 353 | num_of_completed = event.stats.completed + event.stats.failed |
@@ -332,6 +356,10 @@ class RunningBuild (gobject.GObject): | |||
332 | message["title"] = "" | 356 | message["title"] = "" |
333 | message["task"] = event.taskstring | 357 | message["task"] = event.taskstring |
334 | self.emit("task-started", message) | 358 | self.emit("task-started", message) |
359 | elif isinstance(event, bb.event.MultipleProviders): | ||
360 | self.emit("log", "info", "multiple providers are available for %s%s (%s)" \ | ||
361 | % (event._is_runtime and "runtime " or "", event._item, ", ".join(event._candidates))) | ||
362 | self.emit("log", "info", "consider defining a PREFERRED_PROVIDER entry to match %s" % (event._item)) | ||
335 | elif isinstance(event, bb.event.NoProvider): | 363 | elif isinstance(event, bb.event.NoProvider): |
336 | msg = "" | 364 | msg = "" |
337 | if event._runtime: | 365 | if event._runtime: |
@@ -346,6 +374,19 @@ class RunningBuild (gobject.GObject): | |||
346 | for reason in event._reasons: | 374 | for reason in event._reasons: |
347 | msg += ("%s\n" % reason) | 375 | msg += ("%s\n" % reason) |
348 | self.emit("no-provider", msg) | 376 | self.emit("no-provider", msg) |
377 | self.emit("log", msg) | ||
378 | else: | ||
379 | if not isinstance(event, (bb.event.BuildBase, | ||
380 | bb.event.StampUpdate, | ||
381 | bb.event.ConfigParsed, | ||
382 | bb.event.RecipeParsed, | ||
383 | bb.event.RecipePreFinalise, | ||
384 | bb.runqueue.runQueueEvent, | ||
385 | bb.runqueue.runQueueExitWait, | ||
386 | bb.event.OperationStarted, | ||
387 | bb.event.OperationCompleted, | ||
388 | bb.event.OperationProgress)): | ||
389 | self.emit("log", "error", "Unknown event: %s" % (event.error if hasattr(event, 'error') else 'error')) | ||
349 | 390 | ||
350 | return | 391 | return |
351 | 392 | ||