ci: Simplify filter_env_vars using indirect expansion

Avoid parsing variable values manually by using `${!varname@A}`, which
returns the exact declaration as stored in the bash session.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35421>
This commit is contained in:
Guilherme Gallo 2025-06-09 17:50:58 -03:00
parent d77166edec
commit 655cf2f553

View file

@ -352,7 +352,6 @@ function filter_env_vars() {
env -0 | sort -z | while IFS= read -r -d '' line; do env -0 | sort -z | while IFS= read -r -d '' line; do
[[ "$line" == *=* ]] || continue [[ "$line" == *=* ]] || continue
local varname="${line%%=*}" local varname="${line%%=*}"
local value="${line#*=}"
# Skip certain Mesa-specific variables # Skip certain Mesa-specific variables
if echo "$varname" | grep -qxE "$CI_EXCLUDE_ENV_VAR_REGEX"; then if echo "$varname" | grep -qxE "$CI_EXCLUDE_ENV_VAR_REGEX"; then
@ -369,7 +368,7 @@ function filter_env_vars() {
continue continue
fi fi
printf "export %s=%s\n" "$varname" "${value@Q}" echo "${!varname@A}"
done done
x_restore x_restore
} }