2 # SPDX-License-Identifier: LGPL-2.1-or-later
5 # Exclude following paths from the Coccinelle transformations
10 # Symlinked to test-bus-vtable-cc.cc, which causes issues with the IN_SET macro
11 "src/libsystemd/sd-bus/test-bus-vtable.c"
12 "src/libsystemd/sd-journal/lookup3.c"
15 TOP_DIR
="$(git rev-parse --show-toplevel)"
18 # Create an array from files tracked by git...
19 mapfile
-t FILES
< <(git ls-files
':/*.[ch]')
20 # ...and filter everything that matches patterns from EXCLUDED_PATHS
21 for excl
in "${EXCLUDED_PATHS[@]}"; do
22 # shellcheck disable=SC2206
23 FILES
=(${FILES[@]//$excl})
33 if ! parallel
-h >/dev
/null
; then
34 echo 'Please install GNU parallel (package "parallel")'
38 [[ ${#@} -ne 0 ]] && SCRIPTS
=("$@") || SCRIPTS
=("$TOP_DIR"/coccinelle
/*.cocci
)
40 for script in "${SCRIPTS[@]}"; do
41 echo "--x-- Processing $script --x--"
43 echo "+ spatch --sp-file $script ${ARGS[*]} ..."
44 parallel
--halt now
,fail
=1 --keep-order --noswap --max-args=20 \
45 spatch
--macro-file="$TOP_DIR/coccinelle/macros.h" --smpl-spacing --sp-file "$script" "${ARGS[@]}" ::: "${FILES[@]}" \
46 2>"$TMPFILE" ||
cat "$TMPFILE"
47 echo -e "--x-- Processed $script --x--\n"