blob: 585e9b47bc84a75648126bc88e5c299765fa0d4f [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"
Robert Collins86923552015-06-19 11:17:04 +120033 # bring down global requirements
34 git_clone $REQUIREMENTS_REPO $REQUIREMENTS_DIR $REQUIREMENTS_BRANCH
35 [ ! -d $PIP_VIRTUAL_ENV ] && virtualenv $PIP_VIRTUAL_ENV
36 # We don't care about testing git pbr in the requirements venv.
37 PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install -U pbr
38 PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install $REQUIREMENTS_DIR
Robert Collins40f3e332015-06-19 08:04:00 +120039
Sean Dague0392a102013-07-31 13:07:45 -040040 # Install pbr
Sean Daguecc524062014-10-01 09:06:43 -040041 if use_library_from_git "pbr"; then
42 git_clone_by_name "pbr"
43 setup_lib "pbr"
44 else
Clark Boylan013f52b2014-12-23 16:56:15 -080045 # Always upgrade pbr to latest version as we may have pulled it
46 # in via system packages.
47 pip_install "-U" "pbr"
Sean Daguecc524062014-10-01 09:06:43 -040048 fi
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: