summaryrefslogtreecommitdiffstats
path: root/tools/checkpatch.sh
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-02-15 19:37:03 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-02-22 18:54:42 +0100
commit86d488ce66e0b3affb4aec48f10ad5152a861f49 (patch)
treeed781540f63fd13e1e70201994bfb922be7a4753 /tools/checkpatch.sh
parenttools: return exit status in checkpatch.sh (diff)
downloadfrr-86d488ce66e0b3affb4aec48f10ad5152a861f49.tar.xz
frr-86d488ce66e0b3affb4aec48f10ad5152a861f49.zip
tools: improve checkpatch.sh
* Send reports to stderr; this allows you to get just the end result by redirecting stderr * Don't attempt to copy nonexistent files Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'tools/checkpatch.sh')
-rwxr-xr-xtools/checkpatch.sh21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh
index 3536df79a..f55692096 100755
--- a/tools/checkpatch.sh
+++ b/tools/checkpatch.sh
@@ -45,10 +45,19 @@ echo $mod
if [ -z "$mod" ]; then
echo "There doesn't seem to be any changes."
else
- cp $tree/$mod /tmp/f1/
+ echo "Copying source to temp directory..."
+ for file in $mod; do
+ echo "$tree/$file --> /tmp/f1/$file"
+ cp $tree/$file /tmp/f1/
+ done
git -C $tree reset --hard
git -C $tree clean -fd
- cp $tree/$mod /tmp/f2/
+ for file in $mod; do
+ if [ -f $tree/$file ]; then
+ echo "$tree/$file --> /tmp/f2/$file"
+ cp $tree/$file /tmp/f2/
+ fi
+ done
echo "Running style checks..."
for file in /tmp/f1/*; do
echo "$checkpatch $file > $file _cp"
@@ -60,12 +69,12 @@ else
done
echo "Done."
for file in /tmp/f1/*_cp; do
- echo "Report for $(basename $file _cp)"
- echo "==============================================="
+ echo "Report for $(basename $file _cp)" 1>&2
+ echo "===============================================" 1>&2
if [ -a /tmp/f2/$(basename $file) ]; then
- diff $file /tmp/f2/$(basename $file) | grep -v "normally be const" | grep -A3 "ERROR\|WARNING"
+ diff $file /tmp/f2/$(basename $file) | grep -v "normally be const" | grep -A3 "ERROR\|WARNING" 1>&2
else
- cat $file | grep -v "normally be const" | grep -A3 "ERROR\|WARNING"
+ cat $file | grep -v "normally be const" | grep -A3 "ERROR\|WARNING" 1>&2
fi
if [ "$?" -eq "0" ]; then
stat=1