From add5b51c6a4000f8e445cde7f64cd176c77496e3 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 16 Dec 2009 18:58:46 +0000 Subject: kernel-cp: a local wrapper to the kernel's checkpatch script. checkpatch.pl is a script intended to check style of code (normally: before submitting kernel patches). As using this script simplifies testing new code for coding style, this commit officially closes issue #16191 . git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7702 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- build_tools/kernel-cp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 build_tools/kernel-cp (limited to 'build_tools') diff --git a/build_tools/kernel-cp b/build_tools/kernel-cp new file mode 100755 index 0000000..644e1f4 --- /dev/null +++ b/build_tools/kernel-cp @@ -0,0 +1,48 @@ +#!/bin/sh + +# A simple wrapper to the kernel.org script checkpatch.pl + +# Usage: +# +# svn diff | ./build_tools/kernel-cp - +# ./build_tools/kernel-cp my.diff +# ./build_tools/kernel-cp --file drivers/dahdi/wctdm.c + +mydir=`dirname $0` + +check_patch_dir="$mydir/cp" +rel_path="scripts/checkpatch.pl" +check_patch="$mydir/checkpatch.pl" +URL='http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=scripts/checkpatch.pl;hb=HEAD' + +# Required files in directories in the tree +SUBDIRS="fs ipc lib arch init scripts drivers kernel Documentation include" + +set -e + +if [ "$1" = 'download' ]; then + if [ -x "$check_patch" ]; then + exit 0 + fi + + wget -O "$check_patch" "$URL" + if [ `wc -c "$check_patch"` -lt 1000 ]; then + # already downloaded + # FIXME: redirection fails on downloading and you get a + # short HTML file as your "script". + echo >&2 "$0: Error: Download failed". + exit 1 + fi + chmod +x "$check_patch" + + exit 0 +fi + +if [ ! -x "$check_patch" ]; then + echo >&2 "Script $check_patch not found. Download it?" + echo >&2 "" + echo >&2 " $0 download" + exit 1 +fi + +exec $check_patch --no-tree --no-signoff "$@" -- cgit v1.2.3