ci: preserve PATH when running waf under sudo
Change-Id: I85bdc5b69de2c2c7b8c0dc5a7aa2927b495e2168
Refs: #4186
diff --git a/.jenkins.d/util.sh b/.jenkins.d/util.sh
old mode 100755
new mode 100644
index 81c8931..a89bc27
--- a/.jenkins.d/util.sh
+++ b/.jenkins.d/util.sh
@@ -1,9 +1,18 @@
has() {
+ local saved_xtrace
+ [[ $- == *x* ]] && saved_xtrace=-x || saved_xtrace=+x
+ set +x
+
local p=$1
shift
- local x
- for x in "$@"; do
- [[ "${x}" == "${p}" ]] && return 0
+ local i ret=1
+ for i in "$@"; do
+ if [[ "${i}" == "${p}" ]]; then
+ ret=0
+ break
+ fi
done
- return 1
+
+ set ${saved_xtrace}
+ return ${ret}
}