From 5b345d482f1d7d69d63e827310e9618a6cda91ef Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 8 Jun 2011 20:21:42 +0100 Subject: build/runqueue: Pass quieterrors flag around to supress errors at task execution time Signed-off-by: Richard Purdie --- lib/bb/build.py | 22 ++++++++++++++-------- lib/bb/runqueue.py | 4 ++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/bb/build.py b/lib/bb/build.py index 115957b6d..15ba9568f 100644 --- a/lib/bb/build.py +++ b/lib/bb/build.py @@ -257,7 +257,7 @@ def _task_data(fn, task, d): data.expandKeys(localdata) return localdata -def _exec_task(fn, task, d): +def _exec_task(fn, task, d, quieterr): """Execute a BB 'task' Execution of a task involves a bit more setup than executing a function, @@ -322,8 +322,9 @@ def _exec_task(fn, task, d): for func in (postfuncs or '').split(): exec_func(func, localdata) except FuncFailed as exc: - logger.error(str(exc)) - event.fire(TaskFailed(task, logfn, localdata), localdata) + if not quieterr: + logger.error(str(exc)) + event.fire(TaskFailed(task, logfn, localdata), localdata) return 1 finally: sys.stdout.flush() @@ -356,13 +357,18 @@ def _exec_task(fn, task, d): def exec_task(fn, task, d): try: - return _exec_task(fn, task, d) + quieterr = False + if d.getVarFlag(task, "quieterrors") is not None: + quieterr = True + + return _exec_task(fn, task, d, quieterr) except Exception: from traceback import format_exc - logger.error("Build of %s failed" % (task)) - logger.error(format_exc()) - failedevent = TaskFailed(task, None, d) - event.fire(failedevent, d) + if not quieterr: + logger.error("Build of %s failed" % (task)) + logger.error(format_exc()) + failedevent = TaskFailed(task, None, d) + event.fire(failedevent, d) return 1 def stamp_internal(taskname, d, file_name): diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py index 2494cb2e9..db1d36d1c 100644 --- a/lib/bb/runqueue.py +++ b/lib/bb/runqueue.py @@ -1117,6 +1117,10 @@ class RunQueueExecute: the_data.setVar("BBHASHDEPS_%s" % h, self.rqdata.hash_deps[h]) os.environ.update(bb.data.exported_vars(the_data)) + + if quieterrors: + the_data.setVarFlag(taskname, "quieterrors", "1") + except Exception as exc: if not quieterrors: logger.critical(str(exc)) -- cgit 1.2.3-korg