aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus S. Wamser <markus.wamser@mixed-mode.de>2018-10-17 16:30:06 +0200
committerJérôme Forissier <jerome.forissier@linaro.org>2018-10-24 15:41:11 +0200
commit33977c011f1fa884da30e6faf2903ac8226dfc95 (patch)
treef67ee975cf568e077d213d9b159ce7a78a7c08e2 /scripts
parentcd278f78382b8717bd18ba6de7b26a6cbd0fa3e5 (diff)
auto-locate checkpatch
Try to locate checkpatch.pl in typical location(s) if environment variable CHECKPATCH is not set. The launch script first tries to find checkpatch.pl on the path, next it checks typical locations for linux headers, finally it tries to locate linux sources used for OP-TEE in with QEMU. The first match is used as the checkpatch instance to be invoked. Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/checkpatch.sh b/scripts/checkpatch.sh
index 3d8f1a6b..75524b8e 100755
--- a/scripts/checkpatch.sh
+++ b/scripts/checkpatch.sh
@@ -2,6 +2,20 @@
DIR="${BASH_SOURCE%/*}"
+# if no CHECKPATCH is explicitly given by the environment, try to
+# locate checkpatch.pl: first take the one from the path, then check
+# for a local copy of the linux headers, finally try sources downloaded
+# with OP-TEE (for QEMU)
+if [ -z "$CHECKPATCH" ]; then
+ CHECKPATCH=$(command -v checkpatch.pl)
+fi
+if [ -z "$CHECKPATCH" ]; then
+ CHECKPATCH=$(find /usr/src/linux-headers* -name checkpatch.pl -print -quit)
+fi
+if [ -z "$CHECKPATCH" ]; then
+ CHECKPATCH=$(find "$PWD/../linux" -name checkpatch.pl -print -quit)
+fi
+
source "$DIR/checkpatch_inc.sh"
hash $CHECKPATCH 2>/dev/null ||