diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-12-16 18:58:46 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-12-16 18:58:46 +0000 |
commit | add5b51c6a4000f8e445cde7f64cd176c77496e3 (patch) | |
tree | ca5581b70fbc4369193630b5a2539586eb64c009 /build_tools | |
parent | f64d30da503e3d0269d7ba2c8d2ab975a02ff0e5 (diff) |
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
Diffstat (limited to 'build_tools')
-rwxr-xr-x | build_tools/kernel-cp | 48 |
1 files changed, 48 insertions, 0 deletions
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 "$@" |