blob: cf003cce01acec098423f0ea4a692b9fcd27d6e4 [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
Sean Dague0392a102013-07-31 13:07:45 -04003# lib/infra
4#
5# Functions to install infrastructure projects needed by other projects
6# early in the cycle. We need this so we can do things like gate on
7# requirements as a global list
8
9# Dependencies:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010010#
11# - ``functions`` file
Sean Dague0392a102013-07-31 13:07:45 -040012
13# ``stack.sh`` calls the entry points in this order:
14#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010015# - install_infra
Sean Dague0392a102013-07-31 13:07:45 -040016
17# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +110018_XTRACE_INFRA=$(set +o | grep xtrace)
Sean Dague0392a102013-07-31 13:07:45 -040019set +o xtrace
20
21
22# Defaults
23# --------
Sean Daguecc524062014-10-01 09:06:43 -040024GITDIR["pbr"]=$DEST/pbr
Sean Dague0392a102013-07-31 13:07:45 -040025
26# Entry Points
27# ------------
28
Sean Dague0392a102013-07-31 13:07:45 -040029# install_infra() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110030function install_infra {
Robert Collins40f3e332015-06-19 08:04:00 +120031 local PIP_VIRTUAL_ENV="$REQUIREMENTS_DIR/.venv"
Robert Collins86923552015-06-19 11:17:04 +120032 [ ! -d $PIP_VIRTUAL_ENV ] && virtualenv $PIP_VIRTUAL_ENV
33 # We don't care about testing git pbr in the requirements venv.
34 PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install -U pbr
35 PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install $REQUIREMENTS_DIR
Robert Collins40f3e332015-06-19 08:04:00 +120036
Robert Collins7ebe8e02015-06-23 09:41:21 +120037 # Unset the PIP_VIRTUAL_ENV so that PBR does not end up trapped
38 # down the VENV well
39 unset PIP_VIRTUAL_ENV
40
Sean Dague0392a102013-07-31 13:07:45 -040041 # Install pbr
Sean Daguecc524062014-10-01 09:06:43 -040042 if use_library_from_git "pbr"; then
43 git_clone_by_name "pbr"
Sean Dague2105b9f2015-09-10 14:01:40 -040044 setup_dev_lib "pbr"
Sean Daguecc524062014-10-01 09:06:43 -040045 else
Clark Boylan013f52b2014-12-23 16:56:15 -080046 # Always upgrade pbr to latest version as we may have pulled it
47 # in via system packages.
48 pip_install "-U" "pbr"
Sean Daguecc524062014-10-01 09:06:43 -040049 fi
Sean Dague0392a102013-07-31 13:07:45 -040050}
51
52# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +110053$_XTRACE_INFRA
Sean Dague0392a102013-07-31 13:07:45 -040054
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010055# Tell emacs to use shell-script-mode
56## Local variables:
57## mode: shell-script
58## End: