ci: preserve PATH when running waf under sudo
Change-Id: I85bdc5b69de2c2c7b8c0dc5a7aa2927b495e2168
Refs: #4186
diff --git a/.jenkins.d/10-ndn-cxx.sh b/.jenkins.d/10-ndn-cxx.sh
index c23a0bc..9f8a9b2 100755
--- a/.jenkins.d/10-ndn-cxx.sh
+++ b/.jenkins.d/10-ndn-cxx.sh
@@ -1,10 +1,11 @@
#!/usr/bin/env bash
-set -x
set -e
JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "$JDIR"/util.sh
+set -x
+
pushd /tmp >/dev/null
INSTALLED_VERSION=
@@ -39,9 +40,10 @@
# sudo rm -Rf ndn-cxx-latest
# fi
-sudo rm -Rf /usr/local/include/ndn-cxx
+sudo rm -f /usr/local/bin/ndnsec*
+sudo rm -fr /usr/local/include/ndn-cxx
sudo rm -f /usr/local/lib/libndn-cxx*
-sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
+sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
## Change to the hotfix directory instead of the normal ndn-cxx directory
## Restore below line when #3920 and #4119 merge.
@@ -51,7 +53,7 @@
./waf configure -j1 --color=yes --enable-shared --disable-static --without-osx-keychain
./waf -j1 --color=yes
-sudo ./waf install -j1 --color=yes
+sudo env "PATH=$PATH" ./waf install --color=yes
popd >/dev/null
popd >/dev/null
diff --git a/.jenkins.d/11-chronosync.sh b/.jenkins.d/11-chronosync.sh
index eafc573..3d87d4a 100755
--- a/.jenkins.d/11-chronosync.sh
+++ b/.jenkins.d/11-chronosync.sh
@@ -35,7 +35,7 @@
# sudo rm -Rf ChronoSync-latest
# fi
-sudo rm -Rf /usr/local/include/ChronoSync
+sudo rm -fr /usr/local/include/ChronoSync
sudo rm -f /usr/local/lib/libChronoSync*
sudo rm -f /usr/local/lib/pkgconfig/ChronoSync*
@@ -48,7 +48,7 @@
./waf -j1 --color=yes configure
./waf -j1 --color=yes build
-sudo ./waf install -j1 --color=yes
+sudo env "PATH=$PATH" ./waf install --color=yes
popd >/dev/null
popd >/dev/null
diff --git a/.jenkins.d/20-build.sh b/.jenkins.d/20-build.sh
index 6306a52..a3c171e 100755
--- a/.jenkins.d/20-build.sh
+++ b/.jenkins.d/20-build.sh
@@ -1,27 +1,31 @@
#!/usr/bin/env bash
-set -x
set -e
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
git submodule init
git submodule sync
git submodule update
# Cleanup
-sudo ./waf -j1 --color=yes distclean
+sudo env "PATH=$PATH" ./waf --color=yes distclean
# Configure/build in debug mode
./waf -j1 --color=yes configure --with-tests --debug
./waf -j1 --color=yes build
# Cleanup
-sudo ./waf -j1 --color=yes distclean
+sudo env "PATH=$PATH" ./waf --color=yes distclean
# Configure/build in optimized mode without tests
./waf -j1 --color=yes configure
./waf -j1 --color=yes build
# Cleanup
-sudo ./waf -j1 --color=yes distclean
+sudo env "PATH=$PATH" ./waf --color=yes distclean
if [[ $JOB_NAME == *"code-coverage" ]]; then
COVERAGE="--with-coverage"
@@ -35,4 +39,5 @@
# (tests will be run against optimized version)
-sudo ./waf install --color=yes
+# Install
+sudo env "PATH=$PATH" ./waf --color=yes install
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}
}
diff --git a/.travis.yml b/.travis.yml
index c82707c..66e7c5a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,25 +1,32 @@
sudo: required
language: generic
+
matrix:
include:
+ # Linux/gcc
- os: linux
dist: trusty
env:
- - CXX=g++
+ - CXX=g++-4.8
- NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+
+ # Linux/clang
- os: linux
dist: trusty
env:
- CXX=clang++
- NODE_LABELS="Linux Ubuntu Ubuntu-14.04"
+
+ # macOS/clang
+ # https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
- os: osx
osx_image: xcode8.2
env:
- - CXX=clang++
- NODE_LABELS="OSX OSX-10.12"
-notifications:
- email:
- on_success: always
- on_failure: always
+
+before_script:
+ - ${CXX:-c++} --version
+ - python --version
+
script:
- ./.jenkins