From: Peter Maydell Date: Fri, 16 Jan 2026 12:40:02 +0000 (+0000) Subject: scripts/clean-includes: Make ignore-regexes one per line X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a4a5c68c4ba906d10d0c98e2e49408a6cc5b917;p=thirdparty%2Fqemu.git scripts/clean-includes: Make ignore-regexes one per line Currently we have a single extended regular expression defining files that clean-includes should ignore. This is now very long and awkward to read and edit. Switch to having a list of newline-separated EREs that we write to a file for grep's -f option, so we can express them more legibly in the shell script. We allow for comments in the regex list, which lets us document why we have put the exclusions in. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20260116124005.925382-4-peter.maydell@linaro.org --- diff --git a/scripts/clean-includes b/scripts/clean-includes index 568033ee9c..5ab3b07196 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -42,8 +42,6 @@ GIT=no DUPHEAD=no -# Extended regular expression defining files to ignore when using --all -XDIRREGEX='^(tests/tcg|tests/multiboot|tests/fp|tests/plugin|tests/uefi-test-tools|pc-bios|subprojects|contrib/plugins|tools/ebpf|ebpf/rss.bpf.skeleton.h|linux-user/(mips64|x86_64)/(cpu_loop|signal).c)' while true do @@ -83,15 +81,33 @@ if [ "$1" = "--all" ]; then set -- '.' fi -# We assume there are no files in the tree with spaces in their name -set -- $(git ls-files "$@" | grep '\.[ch]$' | grep -E -v "$XDIRREGEX") - # Annoyingly coccinelle won't read a scriptfile unless its # name ends '.cocci', so write it out to a tempfile with the # right kind of name. COCCIFILE="$(mktemp --suffix=.cocci)" +REGEXFILE="$(mktemp --suffix=.regex)" + +trap 'rm -f -- "$COCCIFILE" "$REGEXFILE"' INT TERM HUP EXIT + +# List of extended regular expressions defining files to ignore +# Comments starting with '#' are permitted +grep -v '^#' >"$REGEXFILE" <"$COCCIFILE" <