From 5d81f07c16c7e3be8310158796f6c23eb15de74d Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Tue, 25 Mar 2025 10:07:54 +0100 Subject: [PATCH] b4-wrapper-poky.py: output errors to stderr Print error messages to stderr instead of stdout. The commands run as part of send-auto-cc-cmd and send-auto-to-cmd b4 commands will make b4 raise an Exception if they return a non-zero return code and it will only print the content of stderr before that. Because print defaults to stdout, b4 would raise the exception and not tell the user why. This commit should now provide a hint to the user about what went wrong. Reported-by: Khem Raj (From OE-Core rev: 225990c55a5cbf8498e2aa775e6406c27a4c0ea7) Signed-off-by: Quentin Schulz Signed-off-by: Richard Purdie --- scripts/b4-wrapper-poky.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/b4-wrapper-poky.py b/scripts/b4-wrapper-poky.py index ec6568eb9b..f1170db06b 100755 --- a/scripts/b4-wrapper-poky.py +++ b/scripts/b4-wrapper-poky.py @@ -53,7 +53,7 @@ subject = None ref = None if not shutil.which("lsdiff"): - print("lsdiff missing from host, please install patchutils") + print("lsdiff missing from host, please install patchutils", file=sys.stderr) sys.exit(-1) try: @@ -80,7 +80,7 @@ try: break if not ref: - print("Failed to find ref to cover letter (References:)...") + print("Failed to find ref to cover letter (References:)...", file=sys.stderr) sys.exit(-2) ref = ref.group(1) @@ -143,7 +143,8 @@ try: if cmd == "prep-perpatch-check-cmd": if len(projs) > 1: - print(f"Diff spans more than one project ({', '.join(sorted(projs))}), split into multiple commits...") + print(f"Diff spans more than one project ({', '.join(sorted(projs))}), split into multiple commits...", + file=sys.stderr) sys.exit(-3) # No need to check other patches in the series as there aren't any @@ -164,7 +165,8 @@ try: series_check.write_text('\n'.join(uniq_series_projs)) if len(uniq_series_projs) > 1: - print(f"Series spans more than one project ({', '.join(sorted(uniq_series_projs))}), split into multiple series...") + print(f"Series spans more than one project ({', '.join(sorted(uniq_series_projs))}), split into multiple series...", + file=sys.stderr) sys.exit(-4) else: # send-auto-cc-cmd / send-auto-to-cmd ml_projs = {