DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] devtools: give checkpatches.sh some way of finding the perl script
@ 2022-09-07 15:01 Henning Schild
  2022-10-11  0:21 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Henning Schild @ 2022-09-07 15:01 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Henning Schild

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] devtools: give checkpatches.sh some way of finding the perl script
  2022-09-07 15:01 [PATCH] devtools: give checkpatches.sh some way of finding the perl script Henning Schild
@ 2022-10-11  0:21 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2022-10-11  0:21 UTC (permalink / raw)
  To: Henning Schild; +Cc: dev

07/09/2022 17:01, Henning Schild:
> 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>

Applied, thanks.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-11  0:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 15:01 [PATCH] devtools: give checkpatches.sh some way of finding the perl script Henning Schild
2022-10-11  0:21 ` Thomas Monjalon

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).