blob: f77a4fa941fd1739c4e7ef8820eb807b4746a4ca [file] [log] [blame]
Sean Dague1b6b5312013-07-31 06:46:34 -04001# lib/oslo
2#
3# Functions to install oslo libraries from git
4#
5# We need this to handle the fact that projects would like to use
6# pre-released versions of oslo libraries.
7
8# Dependencies:
9# ``functions`` file
10
11# ``stack.sh`` calls the entry points in this order:
12#
13# install_oslo
14
15# Save trace setting
16XTRACE=$(set +o | grep xtrace)
17set +o xtrace
18
19
20# Defaults
21# --------
22OSLOCFG_DIR=$DEST/oslo.config
23OSLOMSG_DIR=$DEST/oslo.messaging
24
25# Entry Points
26# ------------
27
28# install_oslo() - Collect source and prepare
29function install_oslo() {
Sean Daguedb5fadb2013-08-09 13:41:33 -040030 # TODO(sdague): remove this once we get to Icehouse, this just makes
31 # for a smoother transition of existing users.
32 cleanup_oslo
33
Sean Dague1b6b5312013-07-31 06:46:34 -040034 git_clone $OSLOCFG_REPO $OSLOCFG_DIR $OSLOCFG_BRANCH
35 setup_develop $OSLOCFG_DIR
36
37 git_clone $OSLOMSG_REPO $OSLOMSG_DIR $OSLOMSG_BRANCH
38 setup_develop $OSLOMSG_DIR
39}
40
Sean Daguedb5fadb2013-08-09 13:41:33 -040041# cleanup_oslo() - purge possibly old versions of oslo
42function cleanup_oslo() {
Alessio Ababilovc2a4c922013-08-16 21:53:22 +030043 # this means we've got an old oslo installed, lets get rid of it
Attila Fazekas025fc5e2013-08-13 18:55:33 +020044 if ! python -c 'import oslo.config' 2>/dev/null; then
Sean Daguedb5fadb2013-08-09 13:41:33 -040045 echo "Found old oslo.config... removing to ensure consistency"
46 local PIP_CMD=$(get_pip_command)
Alessio Ababilovc2a4c922013-08-16 21:53:22 +030047 pip_install oslo.config
48 sudo $PIP_CMD uninstall -y oslo.config
Sean Daguedb5fadb2013-08-09 13:41:33 -040049 fi
50}
51
Sean Dague1b6b5312013-07-31 06:46:34 -040052# Restore xtrace
53$XTRACE
54
55# Local variables:
56# mode: shell-script
57# End: