diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-07-19 11:56:03 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-21 08:41:12 +0100 |
| commit | 21bb330f4632ae9e8dd9eaff2879bcd24f9cf194 (patch) | |
| tree | 476a3ff0b5d7fc0f89fafc0cba2b720a6e6b5f3e /bitbake/lib/bb/ui | |
| parent | eb7401d47087ba2347dcf780a0d07969bed4c072 (diff) | |
| download | poky-21bb330f4632ae9e8dd9eaff2879bcd24f9cf194.tar.gz | |
bitbake: lib/bb/event: refactor printing events
We really ought to have just one place where the string representation
of these events is produced. This doesn't take any real control away
from the UI - if an alternative representation is desired, that can
still be made.
(Bitbake rev: cb15db2a799be6d8eab9a2a43a9a573f89229cff)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
| -rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 37 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 2 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/taskexp.py | 20 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/toasterui.py | 25 |
4 files changed, 13 insertions, 71 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 1aa5ebb287..c3019822c4 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
| @@ -560,7 +560,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
| 560 | return_value = event.exitcode | 560 | return_value = event.exitcode |
| 561 | if event.error: | 561 | if event.error: |
| 562 | errors = errors + 1 | 562 | errors = errors + 1 |
| 563 | logger.error("Command execution failed: %s", event.error) | 563 | logger.error(str(event)) |
| 564 | main.shutdown = 2 | 564 | main.shutdown = 2 |
| 565 | continue | 565 | continue |
| 566 | if isinstance(event, bb.command.CommandExit): | 566 | if isinstance(event, bb.command.CommandExit): |
| @@ -571,39 +571,16 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
| 571 | main.shutdown = 2 | 571 | main.shutdown = 2 |
| 572 | continue | 572 | continue |
| 573 | if isinstance(event, bb.event.MultipleProviders): | 573 | if isinstance(event, bb.event.MultipleProviders): |
| 574 | logger.info("multiple providers are available for %s%s (%s)", event._is_runtime and "runtime " or "", | 574 | logger.info(str(event)) |
| 575 | event._item, | ||
| 576 | ", ".join(event._candidates)) | ||
| 577 | rtime = "" | ||
| 578 | if event._is_runtime: | ||
| 579 | rtime = "R" | ||
| 580 | logger.info("consider defining a PREFERRED_%sPROVIDER entry to match %s" % (rtime, event._item)) | ||
| 581 | continue | 575 | continue |
| 582 | if isinstance(event, bb.event.NoProvider): | 576 | if isinstance(event, bb.event.NoProvider): |
| 583 | if event._runtime: | ||
| 584 | r = "R" | ||
| 585 | else: | ||
| 586 | r = "" | ||
| 587 | |||
| 588 | extra = '' | ||
| 589 | if not event._reasons: | ||
| 590 | if event._close_matches: | ||
| 591 | extra = ". Close matches:\n %s" % '\n '.join(event._close_matches) | ||
| 592 | |||
| 593 | # For universe builds, only show these as warnings, not errors | 577 | # For universe builds, only show these as warnings, not errors |
| 594 | h = logger.warning | ||
| 595 | if not universe: | 578 | if not universe: |
| 596 | return_value = 1 | 579 | return_value = 1 |
| 597 | errors = errors + 1 | 580 | errors = errors + 1 |
| 598 | h = logger.error | 581 | logger.error(str(event)) |
| 599 | |||
| 600 | if event._dependees: | ||
| 601 | h("Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)%s", r, event._item, ", ".join(event._dependees), r, extra) | ||
| 602 | else: | 582 | else: |
| 603 | h("Nothing %sPROVIDES '%s'%s", r, event._item, extra) | 583 | logger.warning(str(event)) |
| 604 | if event._reasons: | ||
| 605 | for reason in event._reasons: | ||
| 606 | h("%s", reason) | ||
| 607 | continue | 584 | continue |
| 608 | 585 | ||
| 609 | if isinstance(event, bb.runqueue.sceneQueueTaskStarted): | 586 | if isinstance(event, bb.runqueue.sceneQueueTaskStarted): |
| @@ -625,13 +602,11 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
| 625 | if isinstance(event, bb.runqueue.runQueueTaskFailed): | 602 | if isinstance(event, bb.runqueue.runQueueTaskFailed): |
| 626 | return_value = 1 | 603 | return_value = 1 |
| 627 | taskfailures.append(event.taskstring) | 604 | taskfailures.append(event.taskstring) |
| 628 | logger.error("Task (%s) failed with exit code '%s'", | 605 | logger.error(str(event)) |
| 629 | event.taskstring, event.exitcode) | ||
| 630 | continue | 606 | continue |
| 631 | 607 | ||
| 632 | if isinstance(event, bb.runqueue.sceneQueueTaskFailed): | 608 | if isinstance(event, bb.runqueue.sceneQueueTaskFailed): |
| 633 | logger.warning("Setscene task (%s) failed with exit code '%s' - real task will be run instead", | 609 | logger.warning(str(event)) |
| 634 | event.taskstring, event.exitcode) | ||
| 635 | continue | 610 | continue |
| 636 | 611 | ||
| 637 | if isinstance(event, bb.event.DepTreeGenerated): | 612 | if isinstance(event, bb.event.DepTreeGenerated): |
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index ca845a32ad..8690c529cc 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py | |||
| @@ -315,7 +315,7 @@ class NCursesUI: | |||
| 315 | # also allow them to now exit with a single ^C | 315 | # also allow them to now exit with a single ^C |
| 316 | shutdown = 2 | 316 | shutdown = 2 |
| 317 | if isinstance(event, bb.command.CommandFailed): | 317 | if isinstance(event, bb.command.CommandFailed): |
| 318 | mw.appendText("Command execution failed: %s" % event.error) | 318 | mw.appendText(str(event)) |
| 319 | time.sleep(2) | 319 | time.sleep(2) |
| 320 | exitflag = True | 320 | exitflag = True |
| 321 | if isinstance(event, bb.command.CommandExit): | 321 | if isinstance(event, bb.command.CommandExit): |
diff --git a/bitbake/lib/bb/ui/taskexp.py b/bitbake/lib/bb/ui/taskexp.py index 9d14ecefaf..0d0f9f5a40 100644 --- a/bitbake/lib/bb/ui/taskexp.py +++ b/bitbake/lib/bb/ui/taskexp.py | |||
| @@ -286,23 +286,7 @@ def main(server, eventHandler, params): | |||
| 286 | continue | 286 | continue |
| 287 | 287 | ||
| 288 | if isinstance(event, bb.event.NoProvider): | 288 | if isinstance(event, bb.event.NoProvider): |
| 289 | if event._runtime: | 289 | print(str(event)) |
| 290 | r = "R" | ||
| 291 | else: | ||
| 292 | r = "" | ||
| 293 | |||
| 294 | extra = '' | ||
| 295 | if not event._reasons: | ||
| 296 | if event._close_matches: | ||
| 297 | extra = ". Close matches:\n %s" % '\n '.join(event._close_matches) | ||
| 298 | |||
| 299 | if event._dependees: | ||
| 300 | print("Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)%s" % (r, event._item, ", ".join(event._dependees), r, extra)) | ||
| 301 | else: | ||
| 302 | print("Nothing %sPROVIDES '%s'%s" % (r, event._item, extra)) | ||
| 303 | if event._reasons: | ||
| 304 | for reason in event._reasons: | ||
| 305 | print(reason) | ||
| 306 | 290 | ||
| 307 | _, error = server.runCommand(["stateShutdown"]) | 291 | _, error = server.runCommand(["stateShutdown"]) |
| 308 | if error: | 292 | if error: |
| @@ -310,7 +294,7 @@ def main(server, eventHandler, params): | |||
| 310 | break | 294 | break |
| 311 | 295 | ||
| 312 | if isinstance(event, bb.command.CommandFailed): | 296 | if isinstance(event, bb.command.CommandFailed): |
| 313 | print("Command execution failed: %s" % event.error) | 297 | print(str(event)) |
| 314 | return event.exitcode | 298 | return event.exitcode |
| 315 | 299 | ||
| 316 | if isinstance(event, bb.command.CommandExit): | 300 | if isinstance(event, bb.command.CommandExit): |
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index 71f04fa5ce..88cec37592 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py | |||
| @@ -320,29 +320,13 @@ def main(server, eventHandler, params): | |||
| 320 | if isinstance(event, bb.event.CacheLoadCompleted): | 320 | if isinstance(event, bb.event.CacheLoadCompleted): |
| 321 | continue | 321 | continue |
| 322 | if isinstance(event, bb.event.MultipleProviders): | 322 | if isinstance(event, bb.event.MultipleProviders): |
| 323 | logger.info("multiple providers are available for %s%s (%s)", event._is_runtime and "runtime " or "", | 323 | logger.info(str(event)) |
| 324 | event._item, | ||
| 325 | ", ".join(event._candidates)) | ||
| 326 | logger.info("consider defining a PREFERRED_PROVIDER entry to match %s", event._item) | ||
| 327 | continue | 324 | continue |
| 328 | 325 | ||
| 329 | if isinstance(event, bb.event.NoProvider): | 326 | if isinstance(event, bb.event.NoProvider): |
| 330 | errors = errors + 1 | 327 | errors = errors + 1 |
| 331 | if event._runtime: | 328 | text = str(event) |
| 332 | r = "R" | ||
| 333 | else: | ||
| 334 | r = "" | ||
| 335 | |||
| 336 | if event._dependees: | ||
| 337 | text = "Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)" % (r, event._item, ", ".join(event._dependees), r) | ||
| 338 | else: | ||
| 339 | text = "Nothing %sPROVIDES '%s'" % (r, event._item) | ||
| 340 | |||
| 341 | logger.error(text) | 329 | logger.error(text) |
| 342 | if event._reasons: | ||
| 343 | for reason in event._reasons: | ||
| 344 | logger.error("%s", reason) | ||
| 345 | text += reason | ||
| 346 | buildinfohelper.store_log_error(text) | 330 | buildinfohelper.store_log_error(text) |
| 347 | continue | 331 | continue |
| 348 | 332 | ||
| @@ -364,8 +348,7 @@ def main(server, eventHandler, params): | |||
| 364 | if isinstance(event, bb.runqueue.runQueueTaskFailed): | 348 | if isinstance(event, bb.runqueue.runQueueTaskFailed): |
| 365 | buildinfohelper.update_and_store_task(event) | 349 | buildinfohelper.update_and_store_task(event) |
| 366 | taskfailures.append(event.taskstring) | 350 | taskfailures.append(event.taskstring) |
| 367 | logger.error("Task (%s) failed with exit code '%s'", | 351 | logger.error(str(event)) |
| 368 | event.taskstring, event.exitcode) | ||
| 369 | continue | 352 | continue |
| 370 | 353 | ||
| 371 | if isinstance(event, (bb.runqueue.sceneQueueTaskCompleted, bb.runqueue.sceneQueueTaskFailed)): | 354 | if isinstance(event, (bb.runqueue.sceneQueueTaskCompleted, bb.runqueue.sceneQueueTaskFailed)): |
| @@ -382,7 +365,7 @@ def main(server, eventHandler, params): | |||
| 382 | if isinstance(event, bb.command.CommandFailed): | 365 | if isinstance(event, bb.command.CommandFailed): |
| 383 | errors += 1 | 366 | errors += 1 |
| 384 | errorcode = 1 | 367 | errorcode = 1 |
| 385 | logger.error("Command execution failed: %s", event.error) | 368 | logger.error(str(event)) |
| 386 | elif isinstance(event, bb.event.BuildCompleted): | 369 | elif isinstance(event, bb.event.BuildCompleted): |
| 387 | buildinfohelper.scan_image_artifacts() | 370 | buildinfohelper.scan_image_artifacts() |
| 388 | buildinfohelper.clone_required_sdk_artifacts() | 371 | buildinfohelper.clone_required_sdk_artifacts() |
