]> git.ipfire.org Git - thirdparty/systemd.git/blame - coccinelle/run-coccinelle.sh
Merge the "boot loader specification" wiki page
[thirdparty/systemd.git] / coccinelle / run-coccinelle.sh
CommitLineData
2d0bc684
LP
1#!/bin/bash -e
2
12b74c38 3top="$(git rev-parse --show-toplevel)"
31d31f20 4files="$(git ls-files ':/*.[ch]')"
00bfe67f
ZJS
5args=
6
7case "$1" in
8 -i)
9 args="$args --in-place"
10 shift
11 ;;
12esac
31d31f20 13
3b253ad6
ZJS
14if ! parallel -h >/dev/null; then
15 echo 'Please install GNU parallel (package "parallel")'
16 exit 1
17fi
18
12b74c38 19for SCRIPT in ${@-$top/coccinelle/*.cocci} ; do
849b6104 20 echo "--x-- Processing $SCRIPT --x--"
2d0bc684 21 TMPFILE=`mktemp`
00bfe67f 22 echo "+ spatch --sp-file $SCRIPT $args ..."
3b253ad6
ZJS
23 parallel --halt now,fail=1 --keep-order --noswap --max-args=20 \
24 spatch --sp-file $SCRIPT $args ::: $files \
25 2>"$TMPFILE" || cat "$TMPFILE"
849b6104 26 echo -e "--x-- Processed $SCRIPT --x--\n"
2d0bc684 27done