blob: 4cc25965ea6b0e5bda32bf97bd61c4ad4fd5ff2b [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
18XTRACE=$(set +o | grep xtrace)
19set +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 -040025REQUIREMENTS_DIR=$DEST/requirements
26
27# Entry Points
28# ------------
29
Sean Dague0392a102013-07-31 13:07:45 -040030# install_infra() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +110031function install_infra {
Robert Collins40f3e332015-06-19 08:04:00 +120032 local PIP_VIRTUAL_ENV="$REQUIREMENTS_DIR/.venv"
33
Sean Dague0392a102013-07-31 13:07:45 -040034 # Install pbr
Sean Daguecc524062014-10-01 09:06:43 -040035 if use_library_from_git "pbr"; then
36 git_clone_by_name "pbr"
37 setup_lib "pbr"
38 else
Clark Boylan013f52b2014-12-23 16:56:15 -080039 # Always upgrade pbr to latest version as we may have pulled it
40 # in via system packages.
41 pip_install "-U" "pbr"
Sean Daguecc524062014-10-01 09:06:43 -040042 fi
Robert Collinsf553ce22015-06-17 13:52:20 +120043
44 # bring down global requirements
45 git_clone $REQUIREMENTS_REPO $REQUIREMENTS_DIR $REQUIREMENTS_BRANCH
Robert Collins40f3e332015-06-19 08:04:00 +120046 [ ! -d $PIP_VIRTUAL_ENV ] && virtualenv $PIP_VIRTUAL_ENV
47 PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install -U pbr
48 PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install $REQUIREMENTS_DIR
Sean Dague0392a102013-07-31 13:07:45 -040049}
50
51# Restore xtrace
52$XTRACE
53
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010054# Tell emacs to use shell-script-mode
55## Local variables:
56## mode: shell-script
57## End: