2015-06-22 18:34:22 +00:00
|
|
|
#! /bin/sh
|
2020-02-09 21:14:52 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright 2015-2020 Mellanox Technologies, Ltd
|
2015-06-22 18:34:22 +00:00
|
|
|
|
|
|
|
# Apply coccinelle transforms.
|
|
|
|
|
|
|
|
SRCTREE=$(readlink -f $(dirname $0)/..)
|
2016-12-15 21:47:44 +00:00
|
|
|
COCCI=$SRCTREE/devtools/cocci
|
2015-06-22 18:34:22 +00:00
|
|
|
[ -n "$SPATCH" ] || SPATCH=$(which spatch)
|
|
|
|
|
|
|
|
PATCH_LIST="$@"
|
|
|
|
[ -n "$PATCH_LIST" ] || PATCH_LIST=$(echo $COCCI/*.cocci)
|
|
|
|
|
|
|
|
[ -x "$SPATCH" ] || (
|
|
|
|
echo "Coccinelle tools not installed."
|
|
|
|
exit 1
|
|
|
|
)
|
|
|
|
|
2018-09-19 17:16:29 +00:00
|
|
|
tmp=$(mktemp -t dpdk.cocci.XXX)
|
2015-06-22 18:34:22 +00:00
|
|
|
|
|
|
|
for c in $PATCH_LIST; do
|
|
|
|
while true; do
|
|
|
|
echo -n "Applying $c..."
|
|
|
|
$SPATCH --sp-file $c -c --linux-spacing --very-quiet \
|
|
|
|
--include-headers --preprocess \
|
|
|
|
--in-place --dir $SRCTREE > $tmp
|
|
|
|
if [ -s $tmp ]; then
|
|
|
|
echo " changes applied, retrying."
|
|
|
|
else
|
|
|
|
echo " no change."
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -f $tmp
|