DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH 6/6] devtools: add quiet mode in uAPI script
Date: Wed, 27 Aug 2025 10:21:49 +0200	[thread overview]
Message-ID: <20250827082413.1417226-7-thomas@monjalon.net> (raw)
In-Reply-To: <20250827082413.1417226-1-thomas@monjalon.net>

Most messages from the Linux uAPI script are not useful
when running the script in a regular fashion.
The quiet mode (option -q) is added to output only error messages if any.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 devtools/linux-uapi.sh | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/devtools/linux-uapi.sh b/devtools/linux-uapi.sh
index 0986b668de..9f9f08035f 100755
--- a/devtools/linux-uapi.sh
+++ b/devtools/linux-uapi.sh
@@ -11,6 +11,7 @@ base_path="kernel/linux/uapi/"
 version=""
 file=""
 check_headers=false
+quiet=false
 
 print_usage()
 {
@@ -43,7 +44,7 @@ update_headers()
 {
 	local header
 
-	echo "Updating to $version"
+	$quiet || echo "Updating to $version"
 	for filename in $(find $base_path -name "*.h" -type f); do
 		header=${filename#$base_path}
 		download_header $header $filename
@@ -65,7 +66,7 @@ import_header()
 	for include in $(sed -ne 's/^#include <\(.*\)>$/\1/p' $path); do
 		if [ ! -f "$base_path$include" ]; then
 			read -p "Import $include (y/n): " import && [ "$import" = 'y' ] || continue
-			echo "Importing $include for $path"
+			$quiet || echo "Importing $include for $path"
 			import_header "$include"
 		fi
 	done
@@ -92,13 +93,13 @@ update_all()
 {
 	if [ -n "$version" ]; then
 		if version_older_than "$version" "$current_version"; then
-			echo "Headers already up to date ($current_version >= $version)"
+			$quiet || echo "Headers already up to date ($current_version >= $version)"
 			version=$current_version
 		else
 			update_headers
 		fi
 	else
-		echo "Version not specified, using current version ($current_version)"
+		$quiet || echo "Version not specified, using current version ($current_version)"
 		version=$current_version
 	fi
 
@@ -115,14 +116,14 @@ update_all()
 
 check_header()
 {
-	echo -n "Checking $1... "
+	$quiet || echo -n "Checking $1... "
 
 	if ! diff -q $1 $2 >/dev/null; then
-		echo "KO"
-		diff -u $1 $2
+		$quiet || echo "KO"
+		$quiet || diff -u $1 $2
 		return 1
 	else
-		echo "OK"
+		$quiet || echo "OK"
 	fi
 
 	return 0
@@ -135,14 +136,16 @@ check_all()
 	tmpheader="$(mktemp -t dpdk.checkuapi.XXXXXX)"
 	trap "rm -f '$tmpheader'" INT
 
-	echo "Checking imported headers for version $version"
+	$quiet || echo "Checking imported headers for version $version"
 	for filename in $(find $base_path -name "*.h" -type f); do
 		header=${filename#$base_path}
 		download_header $header $tmpheader
 		fixup_includes $tmpheader
 		check_header $filename $tmpheader || errors=$((errors+1))
 	done
-	echo "$errors error(s) found"
+	if [ $errors -ne 0 ] || ! $quiet; then
+		echo "$errors error(s) found in Linux uAPI"
+	fi
 
 	rm -f $tmpheader
 	trap - INT
@@ -150,11 +153,12 @@ check_all()
 	return $errors
 }
 
-while getopts i:u:ch opt ; do
+while getopts i:u:cqh opt ; do
 	case $opt in
 		i ) file=$OPTARG ;;
 		u ) version=$OPTARG ;;
 		c ) check_headers=true ;;
+		q ) quiet=true ;;
 		h ) print_usage ; exit 0 ;;
 		? ) print_usage ; exit 1 ;;
 	esac
-- 
2.47.1


      parent reply	other threads:[~2025-08-27  8:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  8:21 [PATCH 0/6] devtools: improve Linux " Thomas Monjalon
2025-08-27  8:21 ` [PATCH 1/6] devtools: remove superfluous curly braces in " Thomas Monjalon
2025-08-27  8:21 ` [PATCH 2/6] devtools: remove superfluous fallbacks " Thomas Monjalon
2025-08-27  8:21 ` [PATCH 3/6] devtools: move uAPI processing into functions Thomas Monjalon
2025-08-27  8:21 ` [PATCH 4/6] devtools: remove unused variables in uAPI script Thomas Monjalon
2025-08-27  8:21 ` [PATCH 5/6] devtools: make uAPI check exclusive to other options Thomas Monjalon
2025-08-27  8:21 ` Thomas Monjalon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250827082413.1417226-7-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).