ci: Explicitly test for meson feature checks in compiler wrapper
authorMichel Dänzer <mdaenzer@redhat.com>
Wed, 12 Apr 2023 09:24:13 +0000 (11:24 +0200)
committerMarge Bot <emma+marge@anholt.net>
Sat, 15 Apr 2023 01:55:12 +0000 (01:55 +0000)
The previous indirect method was more complicated and still error prone.

v2:
* Use "grep -E" (Eric Engestrom)
* Exclude spaces and slashes in the grep pattern, to avoid accidentally
  matching across unrelated compiler arguments.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22438>

.gitlab-ci/build/compiler-wrapper.sh

index 12a70fe..f20b518 100755 (executable)
@@ -6,8 +6,8 @@ else
   CCACHE=
 fi
 
-if [ "$(ps -p $(ps -p $PPID -o ppid --no-headers) -o comm --no-headers)" != ninja ]; then
-    # Not invoked by ninja (e.g. for a meson feature check)
+if echo "$@" | grep -E 'meson-private/tmp[^ /]*/testfile.c' >/dev/null; then
+    # Invoked for meson feature check
     exec $CCACHE $_COMPILER "$@"
 fi