| 1 | #!/bin/sh |
| 2 | |
| 3 | # A simple wrapper to the kernel.org script checkpatch.pl |
| 4 | |
| 5 | # Usage: |
| 6 | # |
| 7 | # svn diff | ./build_tools/kernel-cp - |
| 8 | # ./build_tools/kernel-cp my.diff |
| 9 | # ./build_tools/kernel-cp --file drivers/dahdi/wctdm.c |
| 10 | |
| 11 | mydir=`dirname $0` |
| 12 | |
| 13 | check_patch_dir="$mydir/cp" |
| 14 | rel_path="scripts/checkpatch.pl" |
| 15 | check_patch="$mydir/checkpatch.pl" |
| 16 | URL='http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=scripts/checkpatch.pl;hb=HEAD' |
| 17 | |
| 18 | # Required files in directories in the tree |
| 19 | SUBDIRS="fs ipc lib arch init scripts drivers kernel Documentation include" |
| 20 | |
| 21 | set -e |
| 22 | |
| 23 | if [ "$1" = 'download' ]; then |
| 24 | if [ -x "$check_patch" ]; then |
| 25 | exit 0 |
| 26 | fi |
| 27 | |
| 28 | wget -O "$check_patch" "$URL" |
| 29 | if [ `wc -c <"$check_patch"` -lt 1000 ]; then |
| 30 | # already downloaded |
| 31 | # FIXME: redirection fails on downloading and you get a |
| 32 | # short HTML file as your "script". |
| 33 | echo >&2 "$0: Error: Download failed". |
| 34 | exit 1 |
| 35 | fi |
| 36 | chmod +x "$check_patch" |
| 37 | |
| 38 | exit 0 |
| 39 | fi |
| 40 | |
| 41 | if [ ! -x "$check_patch" ]; then |
| 42 | echo >&2 "Script $check_patch not found. Download it?" |
| 43 | echo >&2 "" |
| 44 | echo >&2 " $0 download" |
| 45 | exit 1 |
| 46 | fi |
| 47 | |
| 48 | exec $check_patch --no-tree --no-signoff "$@" |