Mesa (master): gitlab-ci: fix testing whether a variable with a given name is set or not

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 19 22:09:19 UTC 2020


Module: Mesa
Branch: master
Commit: 72fac11ca37c67a13225dbe8c04e73cdca36ae5f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=72fac11ca37c67a13225dbe8c04e73cdca36ae5f

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Wed Aug 19 16:02:44 2020 +0200

gitlab-ci: fix testing whether a variable with a given name is set or not

The previous code considered unset variables the same as set-but-empty;
sometimes setting a variable as something empty is meaningful, so let's
pass them through properly.

Signed-off-by: Eric Engestrom <eric at engestrom.ch>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6389>

---

 .gitlab-ci/bare-metal/rootfs-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci/bare-metal/rootfs-setup.sh b/.gitlab-ci/bare-metal/rootfs-setup.sh
index 90e9bbf9ebe..220968aa057 100644
--- a/.gitlab-ci/bare-metal/rootfs-setup.sh
+++ b/.gitlab-ci/bare-metal/rootfs-setup.sh
@@ -50,7 +50,7 @@ for var in \
     VK_DRIVER \
     ; do
   val=`echo ${!var} | sed 's|"||g'`
-  if [ -n "$val" ]; then
+  if [ -n "${!var+x}" ]; then
     echo "export $var=\"${val}\"" >> $rootfs_dst/set-job-env-vars.sh
   fi
 done



More information about the mesa-commit mailing list