فهرست منبع

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 <raj.khem@gmail.com>
(From OE-Core rev: 225990c55a5cbf8498e2aa775e6406c27a4c0ea7)

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Quentin Schulz 2 ماه پیش
والد
کامیت
5d81f07c16
1فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 6 4
      scripts/b4-wrapper-poky.py

+ 6 - 4
scripts/b4-wrapper-poky.py

@@ -53,7 +53,7 @@ subject = None
 ref = None
 ref = None
 
 
 if not shutil.which("lsdiff"):
 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)
     sys.exit(-1)
 
 
 try:
 try:
@@ -80,7 +80,7 @@ try:
                 break
                 break
 
 
         if not ref:
         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)
             sys.exit(-2)
 
 
         ref = ref.group(1)
         ref = ref.group(1)
@@ -143,7 +143,8 @@ try:
 
 
     if cmd == "prep-perpatch-check-cmd":
     if cmd == "prep-perpatch-check-cmd":
         if len(projs) > 1:
         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)
             sys.exit(-3)
 
 
         # No need to check other patches in the series as there aren't any
         # 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))
         series_check.write_text('\n'.join(uniq_series_projs))
 
 
         if len(uniq_series_projs) > 1:
         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)
             sys.exit(-4)
     else:  # send-auto-cc-cmd / send-auto-to-cmd
     else:  # send-auto-cc-cmd / send-auto-to-cmd
         ml_projs = {
         ml_projs = {