DPDK patches and discussions
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: <dev@dpdk.org>, Henning Schild <henning.schild@siemens.com>
Subject: [PATCH] devtools: give checkpatches.sh some way of finding the perl script
Date: Wed, 7 Sep 2022 17:01:44 +0200	[thread overview]
Message-ID: <20220907150144.5874-1-henning.schild@siemens.com> (raw)

Try and find the script in the sources of the currently running kernel
so that users do not have to specify DPDK_CHECKPATCH_PATH which might
well be the same location found by the educated guess.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 devtools/checkpatches.sh | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 1edc5810ad10..03e791bd09d5 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -41,7 +41,8 @@ print_usage () {
 	usage: $(basename $0) [-h] [-q] [-v] [-nX|-r range|patch1 [patch2] ...]
 
 	Run Linux kernel checkpatch.pl with DPDK options.
-	The environment variable DPDK_CHECKPATCH_PATH must be set.
+	The environment variable DPDK_CHECKPATCH_PATH can be set, if not we will
+	try to find the script in the sources of the currently running kernel.
 
 	The patches to check can be from stdin, files specified on the command line,
 	latest git commits limited with -n option, or commits in the git range
@@ -256,10 +257,15 @@ done
 shift $(($OPTIND - 1))
 
 if [ ! -f "$DPDK_CHECKPATCH_PATH" ] || [ ! -x "$DPDK_CHECKPATCH_PATH" ] ; then
-	print_usage >&2
-	echo
-	echo 'Cannot execute DPDK_CHECKPATCH_PATH' >&2
-	exit 1
+	default_path="/lib/modules/$(uname -r)/source/scripts/checkpatch.pl"
+	if [ -f "$default_path" ] && [ -x "$default_path" ]; then
+		DPDK_CHECKPATCH_PATH="$default_path"
+	else
+		print_usage >&2
+		echo
+		echo 'Cannot execute DPDK_CHECKPATCH_PATH' >&2
+		exit 1
+	fi
 fi
 
 print_headline() { # <title>
-- 
2.35.1


             reply	other threads:[~2022-09-09 14:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07 15:01 Henning Schild [this message]
2022-10-11  0:21 ` Thomas Monjalon

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=20220907150144.5874-1-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).