X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=scripts%2Fcoccicheck;h=85d31899ad9869620984a388a09b1eac78bcb084;hb=e78aebfd27256ca59ccd3e6cf62cfad2a80e02d3;hp=1a49d1c7ecfeb793a6bd116410f3c6449714eea5;hpb=969e5aa3b0162a02c4f287d48ff58ca2145acf1b;p=~andy%2Flinux diff --git a/scripts/coccicheck b/scripts/coccicheck index 1a49d1c7ecf..85d31899ad9 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -2,6 +2,15 @@ SPATCH="`which ${SPATCH:=spatch}`" +# The verbosity may be set by the environmental parameter V= +# as for example with 'make V=1 coccicheck' + +if [ -n "$V" -a "$V" != "0" ]; then + VERBOSE=1 +else + VERBOSE=0 +fi + if [ "$C" = "1" -o "$C" = "2" ]; then ONLINE=1 @@ -46,6 +55,14 @@ if [ "$ONLINE" = "0" ] ; then echo '' fi +run_cmd() { + if [ $VERBOSE -ne 0 ] ; then + echo "Running: $@" + fi + eval $@ +} + + coccinelle () { COCCI="$1" @@ -55,7 +72,7 @@ coccinelle () { # # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null - if [ "$ONLINE" = "0" ] ; then + if [ $VERBOSE -ne 0 ] ; then FILE=`echo $COCCI | sed "s|$srctree/||"` @@ -91,15 +108,21 @@ coccinelle () { fi if [ "$MODE" = "chain" ] ; then - $SPATCH -D patch $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ - $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ - $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ - $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 + run_cmd $SPATCH -D patch \ + $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ + run_cmd $SPATCH -D report \ + $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ + run_cmd $SPATCH -D context \ + $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ + run_cmd $SPATCH -D org \ + $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 elif [ "$MODE" = "rep+ctxt" ] ; then - $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \ - $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 + run_cmd $SPATCH -D report \ + $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \ + run_cmd $SPATCH -D context \ + $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 else - $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 + run_cmd $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 fi }