File: cocci.sh

package info (click to toggle)
dpdk 25.11-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 127,892 kB
  • sloc: ansic: 2,358,479; python: 16,426; sh: 4,474; makefile: 1,713; awk: 70
file content (36 lines) | stat: -rwxr-xr-x 755 bytes parent folder | download | duplicates (8)
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
#! /bin/sh
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2015-2020 Mellanox Technologies, Ltd

# Apply coccinelle transforms.

SRCTREE=$(readlink -f $(dirname $0)/..)
COCCI=$SRCTREE/devtools/cocci
[ -n "$SPATCH" ] || SPATCH=$(which spatch)

PATCH_LIST="$@"
[ -n "$PATCH_LIST" ] || PATCH_LIST=$(echo $COCCI/*.cocci)

[ -x "$SPATCH" ] || (
	echo "Coccinelle tools not installed."
	exit 1
)

tmp=$(mktemp -t dpdk.cocci.XXX)

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