devtools: guess checkpatch.pl path
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>
This commit is contained in:
parent
9d4efc5cc6
commit
431a60f781
@ -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
|
||||
@ -264,10 +265,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>
|
||||
|
Loading…
Reference in New Issue
Block a user