1#! /bin/sh 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright 2015-2020 Mellanox Technologies, Ltd 4 5# Apply coccinelle transforms. 6 7SRCTREE=$(readlink -f $(dirname $0)/..) 8COCCI=$SRCTREE/devtools/cocci 9[ -n "$SPATCH" ] || SPATCH=$(which spatch) 10 11PATCH_LIST="$@" 12[ -n "$PATCH_LIST" ] || PATCH_LIST=$(echo $COCCI/*.cocci) 13 14[ -x "$SPATCH" ] || ( 15 echo "Coccinelle tools not installed." 16 exit 1 17) 18 19tmp=$(mktemp -t dpdk.cocci.XXX) 20 21for c in $PATCH_LIST; do 22 while true; do 23 echo -n "Applying $c..." 24 $SPATCH --sp-file $c -c --linux-spacing --very-quiet \ 25 --include-headers --preprocess \ 26 --in-place --dir $SRCTREE > $tmp 27 if [ -s $tmp ]; then 28 echo " changes applied, retrying." 29 else 30 echo " no change." 31 break; 32 fi 33 done 34done 35 36rm -f $tmp 37