bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* [1.50][PATCH 0/3] Review request
@ 2021-09-29 14:57 Anuj Mittal
  2021-09-29 14:57 ` [1.50][PATCH 1/3] process: Don't include logs in error message if piping them Anuj Mittal
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anuj Mittal @ 2021-09-29 14:57 UTC (permalink / raw)
  To: bitbake-devel

Please review these changes for 1.50/hardknott. Tested with oe-core and
no issues seen.

Thanks,

Anuj

The following changes since commit 7d938703d9321cde5a32e4dff005f07e8821b704:

  runqueue/knotty: Improve UI handling of setscene task counting (2021-09-24 15:03:33 +0800)

are available in the Git repository at:

  git://push.openembedded.org/bitbake-contrib stable/1.50-next

Richard Purdie (3):
  process: Don't include logs in error message if piping them
  build: Avoid duplicating logs in verbose mode
  build: Handle SystemExit in python tasks correctly

 lib/bb/build.py   | 6 +++++-
 lib/bb/process.py | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)

-- 
2.31.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [1.50][PATCH 1/3] process: Don't include logs in error message if piping them
  2021-09-29 14:57 [1.50][PATCH 0/3] Review request Anuj Mittal
@ 2021-09-29 14:57 ` Anuj Mittal
  2021-09-29 14:57 ` [1.50][PATCH 2/3] build: Avoid duplicating logs in verbose mode Anuj Mittal
  2021-09-29 14:57 ` [1.50][PATCH 3/3] build: Handle SystemExit in python tasks correctly Anuj Mittal
  2 siblings, 0 replies; 4+ messages in thread
From: Anuj Mittal @ 2021-09-29 14:57 UTC (permalink / raw)
  To: bitbake-devel

From: Richard Purdie <richard.purdie@linuxfoundation.org>

If the caller is piping the logs, they likely don't want them in the error exception
as well. This removes duplicate output from the build output allowing the UI level
controls on whether to show logs to work correctly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit fc58ad84a9deb2620ad90611684dad65dafedb11)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 lib/bb/process.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/bb/process.py b/lib/bb/process.py
index 7c3995cce..d5a1775fc 100644
--- a/lib/bb/process.py
+++ b/lib/bb/process.py
@@ -181,5 +181,8 @@ def run(cmd, input=None, log=None, extrafiles=None, **options):
             stderr = stderr.decode("utf-8")
 
     if pipe.returncode != 0:
+        if log:
+            # Don't duplicate the output in the exception if logging it
+            raise ExecutionError(cmd, pipe.returncode, None, None)
         raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
     return stdout, stderr
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [1.50][PATCH 2/3] build: Avoid duplicating logs in verbose mode
  2021-09-29 14:57 [1.50][PATCH 0/3] Review request Anuj Mittal
  2021-09-29 14:57 ` [1.50][PATCH 1/3] process: Don't include logs in error message if piping them Anuj Mittal
@ 2021-09-29 14:57 ` Anuj Mittal
  2021-09-29 14:57 ` [1.50][PATCH 3/3] build: Handle SystemExit in python tasks correctly Anuj Mittal
  2 siblings, 0 replies; 4+ messages in thread
From: Anuj Mittal @ 2021-09-29 14:57 UTC (permalink / raw)
  To: bitbake-devel

From: Richard Purdie <richard.purdie@linuxfoundation.org>

With "bitbake -v", for task failures you'd see the log output twice. Avoid
this by using the existing "did we print info" switch.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit e2c1afda4cb8023ed4ffeb5dc5bee4f0055659a8)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 lib/bb/build.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 24ce327c5..39e7dba02 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -699,6 +699,10 @@ def _exec_task(fn, task, d, quieterr):
                 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata)
             else:
                 errprinted = errchk.triggered
+                # If the output is already on stdout, we've printed the information in the
+                # logs once already so don't duplicate
+                if verboseStdoutLogging:
+                    errprinted = True
                 logger.error(str(exc))
                 event.fire(TaskFailed(task, fn, logfn, localdata, errprinted), localdata)
             return 1
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [1.50][PATCH 3/3] build: Handle SystemExit in python tasks correctly
  2021-09-29 14:57 [1.50][PATCH 0/3] Review request Anuj Mittal
  2021-09-29 14:57 ` [1.50][PATCH 1/3] process: Don't include logs in error message if piping them Anuj Mittal
  2021-09-29 14:57 ` [1.50][PATCH 2/3] build: Avoid duplicating logs in verbose mode Anuj Mittal
@ 2021-09-29 14:57 ` Anuj Mittal
  2 siblings, 0 replies; 4+ messages in thread
From: Anuj Mittal @ 2021-09-29 14:57 UTC (permalink / raw)
  To: bitbake-devel

From: Richard Purdie <richard.purdie@linuxfoundation.org>

If a python task fails with sys.exit(), we currently see no TaskFailed event.
The high level code does detect the exit code and fail the task but it can
leave the UI inconsistent with log output.

Fix this be intercepting SystemExit explicitly. This makes python
task failures consistent with shell task failures.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 9eee9fd4f2f96789ad2b037e74d561bdc1426856)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 lib/bb/build.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 39e7dba02..ad031cc70 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -694,7 +694,7 @@ def _exec_task(fn, task, d, quieterr):
         except bb.BBHandledException:
             event.fire(TaskFailed(task, fn, logfn, localdata, True), localdata)
             return 1
-        except Exception as exc:
+        except (Exception, SystemExit) as exc:
             if quieterr:
                 event.fire(TaskFailedSilent(task, fn, logfn, localdata), localdata)
             else:
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-29 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 14:57 [1.50][PATCH 0/3] Review request Anuj Mittal
2021-09-29 14:57 ` [1.50][PATCH 1/3] process: Don't include logs in error message if piping them Anuj Mittal
2021-09-29 14:57 ` [1.50][PATCH 2/3] build: Avoid duplicating logs in verbose mode Anuj Mittal
2021-09-29 14:57 ` [1.50][PATCH 3/3] build: Handle SystemExit in python tasks correctly Anuj Mittal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).