Skip to contentSkip to conversation

utils/check-package: Add a quiet flag

PATCH New Brandon Maier 3 participants 4 messages Jul 2, 2019 – Jul 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils/check-package: Add a quiet flag

When running in a CI system, stat messages become white noise. Introduce an option to suppress non-error, non-warning, messages.

---
 utils/check-package | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
utils/check-package +5 -2
index ce1fe98d67..f09aaeea03 100755
@@ -33,6 +33,7 @@ def parse_args():
                         default="http://nightly.buildroot.org/",
                         help="default: %(default)s")
     parser.add_argument("--verbose", "-v", action="count", default=0)
+    parser.add_argument("--quiet", "-q", action="count", default=0)
 
     # Now the debug options in the order they are processed.
     parser.add_argument("--include-only", dest="include_list", action="append",
@@ -177,8 +178,10 @@ def __main__():
     # (e.g. counted by 'wc'), so for stats use stderr. Wait all warnings are
     # printed, for the case there are many of them, before printing stats.
     sys.stdout.flush()
-    print("{} lines processed".format(total_lines), file=sys.stderr)
-    print("{} warnings generated".format(total_warnings), file=sys.stderr)
+
+    if not flags.quiet:
+        print("{} lines processed".format(total_lines), file=sys.stderr)
+        print("{} warnings generated".format(total_warnings), file=sys.stderr)
 
     if total_warnings > 0:
         sys.exit(1)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 utils/check-package: Add a quiet flag

Hi Brandon,

Quoted 4 lines · Brandon Maier

When running in a CI system, stat messages become white noise. Introduce an option to suppress non-error, non-warning, messages.

Applied to master, thanks.

However, could you give an example of a case where this is annoying in CI
output? If I look at e.g. the output in gitlab-ci [1], the cruft that is added by gitlab-ci itself makes it pretty verbose already.

Regards,
Arnout

[1] https://gitlab.com/buildroot.org/buildroot/-/jobs/242921394

Quoted 30 lines
---
 utils/check-package | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
utils/check-package +5 -2
index ce1fe98d67..f09aaeea03 100755
@@ -33,6 +33,7 @@ def parse_args():
                         default="http://nightly.buildroot.org/",
                         help="default: %(default)s")
     parser.add_argument("--verbose", "-v", action="count", default=0)
+    parser.add_argument("--quiet", "-q", action="count", default=0)
 
     # Now the debug options in the order they are processed.
     parser.add_argument("--include-only", dest="include_list", action="append",
@@ -177,8 +178,10 @@ def __main__():
     # (e.g. counted by 'wc'), so for stats use stderr. Wait all warnings are
     # printed, for the case there are many of them, before printing stats.
     sys.stdout.flush()
-    print("{} lines processed".format(total_lines), file=sys.stderr)
-    print("{} warnings generated".format(total_warnings), file=sys.stderr)
+
+    if not flags.quiet:
+        print("{} lines processed".format(total_lines), file=sys.stderr)
+        print("{} warnings generated".format(total_warnings), file=sys.stderr)
 
     if total_warnings > 0:
         sys.exit(1)
#2 lore raw

PATCH 1/1 utils/check-package: Add a quiet flag

Quoted 9 lines · Arnout Vandecappelle

Hi Brandon,

Quoted 4 lines · Brandon Maier

When running in a CI system, stat messages become white noise. Introduce an option to suppress non-error, non-warning, messages.

Applied to master, thanks.

Thanks

Quoted 6 lines

However, could you give an example of a case where this is annoying in CI
output? If I look at e.g. the output in gitlab-ci [1], the cruft that is added
by gitlab-ci itself makes it pretty verbose already.

We have a custom tool to run various checks on our team's pull requests and display findings. E.g. check-package, checkpatch, shellcheck, pylint, etc.

It's a simple tool though, and dumps stdout/stderr into the report. So it assumes no output means everything is okay. All the other checkers have a -q equivalent, so figured it'd be easiest to add it to check-package as well.

Quoted 31 lines

Regards,
Arnout

[1] https://gitlab.com/buildroot.org/buildroot/-/jobs/242921394

Quoted 9 lines
---
 utils/check-package | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
utils/check-package +0 -0
index ce1fe98d67..f09aaeea03 100755

utils/check-package def parse_args(): · line 39

Quoted 7 lines
utils/check-package +1 -0
@@ -33,6 +33,7 @@ def parse_args():
                         default="http://nightly.buildroot.org/",
                         help="default: %(default)s")
     parser.add_argument("--verbose", "-v", action="count", default=0)
+    parser.add_argument("--quiet", "-q", action="count", default=0)
 
     # Now the debug options in the order they are processed.
     parser.add_argument("--include-only", dest="include_list",

action="append",

utils/check-package def __main__(): · line 178

Quoted 2 lines
utils/check-package +0 -0
@@ -177,8 +178,10 @@ def __main__():
     # (e.g. counted by 'wc'), so for stats use stderr. Wait all

warnings are

utils/check-package def __main__(): · line 179

Quoted 1 line
utils/check-package +0 -0
     # printed, for the case there are many of them, before printing

stats.

utils/check-package def __main__():

Quoted 3 lines
utils/check-package +0 -2
     sys.stdout.flush()
-    print("{} lines processed".format(total_lines), file=sys.stderr)
-    print("{} warnings generated".format(total_warnings),
Quoted 11 lines

file=sys.stderr)

utils/check-package def __main__():

Quoted 4 lines
utils/check-package +4 -0
+
+    if not flags.quiet:
+        print("{} lines processed".format(total_lines), file=sys.stderr)
+        print("{} warnings generated".format(total_warnings),

file=sys.stderr)

Quoted 4 lines
utils/check-package +0 -0
     if total_warnings > 0:
         sys.exit(1)
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190707/0de8b419/attachment.html>

#3 lore raw

PATCH 1/1 utils/check-package: Add a quiet flag

In reply to Brandon Maier
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Brandon" == Brandon Maier <[email protected]> writes:

When running in a CI system, stat messages become white noise. Introduce an option to suppress non-error, non-warning, messages.

While not really a fix, it seems quite safe and it is easier when tooling behaves the same on the various branches, so committed to 2019.02.x and 2019.05.x - Thanks.

Signature · 1 line
Bye, Peter Korsgaard