2014-12-05 14:25:28 -05:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2013-07-31 13:07:45 -04:00
|
|
|
# lib/infra
|
|
|
|
#
|
|
|
|
# Functions to install infrastructure projects needed by other projects
|
|
|
|
# early in the cycle. We need this so we can do things like gate on
|
|
|
|
# requirements as a global list
|
|
|
|
|
|
|
|
# Dependencies:
|
2013-10-24 11:27:02 +01:00
|
|
|
#
|
|
|
|
# - ``functions`` file
|
2013-07-31 13:07:45 -04:00
|
|
|
|
|
|
|
# ``stack.sh`` calls the entry points in this order:
|
|
|
|
#
|
2013-10-24 11:27:02 +01:00
|
|
|
# - install_infra
|
2013-07-31 13:07:45 -04:00
|
|
|
|
|
|
|
# Save trace setting
|
2015-10-13 11:03:03 +11:00
|
|
|
_XTRACE_INFRA=$(set +o | grep xtrace)
|
2013-07-31 13:07:45 -04:00
|
|
|
set +o xtrace
|
|
|
|
|
|
|
|
|
|
|
|
# Defaults
|
|
|
|
# --------
|
2014-10-01 09:06:43 -04:00
|
|
|
GITDIR["pbr"]=$DEST/pbr
|
2013-07-31 13:07:45 -04:00
|
|
|
|
|
|
|
# Entry Points
|
|
|
|
# ------------
|
|
|
|
|
|
|
|
# install_infra() - Collect source and prepare
|
2014-02-21 15:35:08 +11:00
|
|
|
function install_infra {
|
2015-06-19 08:04:00 +12:00
|
|
|
local PIP_VIRTUAL_ENV="$REQUIREMENTS_DIR/.venv"
|
2015-06-19 11:17:04 +12:00
|
|
|
[ ! -d $PIP_VIRTUAL_ENV ] && virtualenv $PIP_VIRTUAL_ENV
|
|
|
|
# We don't care about testing git pbr in the requirements venv.
|
|
|
|
PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install -U pbr
|
|
|
|
PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install $REQUIREMENTS_DIR
|
2015-06-19 08:04:00 +12:00
|
|
|
|
2015-06-23 09:41:21 +12:00
|
|
|
# Unset the PIP_VIRTUAL_ENV so that PBR does not end up trapped
|
|
|
|
# down the VENV well
|
|
|
|
unset PIP_VIRTUAL_ENV
|
|
|
|
|
2013-07-31 13:07:45 -04:00
|
|
|
# Install pbr
|
2014-10-01 09:06:43 -04:00
|
|
|
if use_library_from_git "pbr"; then
|
|
|
|
git_clone_by_name "pbr"
|
2015-09-10 14:01:40 -04:00
|
|
|
setup_dev_lib "pbr"
|
2014-10-01 09:06:43 -04:00
|
|
|
else
|
2014-12-23 16:56:15 -08:00
|
|
|
# Always upgrade pbr to latest version as we may have pulled it
|
|
|
|
# in via system packages.
|
|
|
|
pip_install "-U" "pbr"
|
2014-10-01 09:06:43 -04:00
|
|
|
fi
|
2013-07-31 13:07:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Restore xtrace
|
2015-10-13 11:03:03 +11:00
|
|
|
$_XTRACE_INFRA
|
2013-07-31 13:07:45 -04:00
|
|
|
|
2013-10-24 11:27:02 +01:00
|
|
|
# Tell emacs to use shell-script-mode
|
|
|
|
## Local variables:
|
|
|
|
## mode: shell-script
|
|
|
|
## End:
|