#!/bin/bash
+. `dirname "$(readlink -f "$0")"`/libcloud-pin
+
read -rd "\000" helpmessage <<EOF
$(basename $0): Install and test Arvados components.
--skip FOO Do not test the FOO component.
--only FOO Do not test anything except the FOO component.
+--temp DIR Install components and dependencies under DIR instead of
+ making a new temporary directory. Implies --leave-temp.
--leave-temp Do not remove GOPATH, virtualenv, and other temp dirs at exit.
- Instead, show which directories were used this time so they
- can be reused in subsequent invocations.
+ Instead, show the path to give as --temp to reuse them in
+ subsequent invocations.
--skip-install Do not run any install steps. Just run tests.
You should provide GOPATH, GEMHOME, and VENVDIR options
from a previous invocation if you use this option.
COLUMNS=80
-leave_temp=
skip_install=
+temp=
+temp_preserve=
-declare -A leave_temp
clear_temp() {
- leaving=""
- for var in VENVDIR VENV3DIR GOPATH GITDIR GEMHOME PERLINSTALLBASE
- do
- if [[ -z "${leave_temp[$var]}" ]]
- then
- if [[ -n "${!var}" ]]
- then
- rm -rf "${!var}"
- fi
- else
- leaving+=" $var=\"${!var}\""
- fi
- done
- if [[ -n "$leaving" ]]; then
- echo "Leaving behind temp dirs: $leaving"
+ if [[ -z "$temp" ]]; then
+ # we didn't even get as far as making a temp dir
+ :
+ elif [[ -z "$temp_preserve" ]]; then
+ rm -rf "$temp"
+ else
+ echo "Leaving behind temp dirs in $temp"
fi
}
skip_install=1
only_install="$1"; shift
;;
+ --temp)
+ temp="$1"; shift
+ temp_preserve=1
+ ;;
--leave-temp)
- leave_temp[VENVDIR]=1
- leave_temp[VENV3DIR]=1
- leave_temp[GOPATH]=1
- leave_temp[GEMHOME]=1
- leave_temp[PERLINSTALLBASE]=1
+ temp_preserve=1
;;
--retry)
retry=1
cd "$WORKSPACE"
find -name '*.pyc' -delete
+if [[ -z "$temp" ]]; then
+ temp="$(mktemp -d)"
+fi
+
# Set up temporary install dirs (unless existing dirs were supplied)
for tmpdir in VENVDIR VENV3DIR GOPATH GEMHOME PERLINSTALLBASE
do
- if [[ -n "${!tmpdir}" ]]; then
- leave_temp[$tmpdir]=1
- mkdir -p "${!tmpdir}"
- else
- eval "$tmpdir"='$(mktemp -d)'
+ if [[ -z "${!tmpdir}" ]]; then
+ eval "$tmpdir"="$temp/$tmpdir"
+ fi
+ if ! [[ -d "${!tmpdir}" ]]; then
+ mkdir "${!tmpdir}" || fatal "can't create ${!tmpdir} (does $temp exist?)"
fi
done
pip install --upgrade setuptools pip
fi
-# Note: this must be the last time we change PATH, otherwise rvm will
-# whine a lot.
-setup_ruby_environment
-
-echo "PATH is $PATH"
-
-if ! which bundler >/dev/null
-then
- gem install --user-install bundler || fatal 'Could not install bundler'
-fi
-
# Needed for run_test_server.py which is used by certain (non-Python) tests.
pip freeze 2>/dev/null | egrep ^PyYAML= \
|| pip install PyYAML >/dev/null \
# Preinstall forked version of libcloud, because nodemanager "pip install"
# won't pick it up by default.
-pip freeze 2>/dev/null | egrep ^apache-libcloud==0.18.1.dev1 \
- || pip install --pre --ignore-installed https://github.com/curoverse/libcloud/archive/apache-libcloud-0.18.1.dev1.zip >/dev/null \
+pip freeze 2>/dev/null | egrep ^apache-libcloud==$LIBCLOUD_PIN \
+ || pip install --pre --ignore-installed https://github.com/curoverse/libcloud/archive/apache-libcloud-$LIBCLOUD_PIN.zip >/dev/null \
|| fatal "pip install apache-libcloud failed"
+# Deactivate Python 2 virtualenv
+deactivate
+
# If Python 3 is available, set up its virtualenv in $VENV3DIR.
# Otherwise, skip dependent tests.
PYTHON3=$(which python3)
if [ "0" = "$?" ]; then
virtualenv --python "$PYTHON3" --setuptools "$VENV3DIR" \
- || fatal "python3 virtualenv $VENV3DIR failed"
+ || fatal "python3 virtualenv $VENV3DIR failed"
+
+ . "$VENV3DIR/bin/activate"
+
+ if (pip install setuptools | grep setuptools-0) || [ "$($VENV3DIR/bin/easy_install --version | cut -d\ -f2 | cut -d. -f1)" -lt 18 ]; then
+ pip install --upgrade setuptools pip
+ fi
+
+ # Deactivate Python 3 virtualenv
+ deactivate
else
PYTHON3=
skip[services/dockercleaner]=1
EOF
fi
+# Reactivate Python 2 virtualenv
+. "$VENVDIR/bin/activate"
+
+# Note: this must be the last time we change PATH, otherwise rvm will
+# whine a lot.
+setup_ruby_environment
+
+echo "PATH is $PATH"
+
+if ! which bundler >/dev/null
+then
+ gem install --user-install bundler || fatal 'Could not install bundler'
+fi
+
checkexit() {
if [[ "$1" != "0" ]]; then
title "!!!!!! $2 FAILED !!!!!!"
services/keepproxy
services/datamanager/summary
services/datamanager/collection
+ services/datamanager
sdk/go/arvadosclient
sdk/go/keepclient
sdk/go/streamer