forked from tcharding/kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpt.sh
executable file
·47 lines (39 loc) · 867 Bytes
/
cpt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#
# Run checkpatch over a directory of patches
# Exclude the cover-letter
base="/home/tobin/build/kdev/patches"
checkpatch='/home/tobin/build/kdev/linux/scripts/checkpatch.pl'
main() {
local dir=$1
local path="$base/$dir"
if [ ! -d $path ]; then
echo "dir not found: $path"
exit 1
fi
for patch in $(ls $path); do
# Skip archives, apply, and old versions.
if [ -d "$path/$patch" ]; then
continue
fi
sub=${patch:0:4} # 0000-foo-bar.patch
subv=${patch:3:4} # v4-0000-foo-bar.patch
if [ $sub == "0000" ] || [ $subv == "0000" ]; then
# echo "found cover-letter: $patch"
continue
fi
$checkpatch --terse --strict $path/$patch
done
}
#
# main script
#
if [[ $# < 1 ]]; then
echo ""
echo "Usage: cpt-dir <dir>"
echo ""
echo " Expects <dir> to be in $base"
echo ""
exit 1
fi
main $@