blob: 816ae9a48afcb79fc69752dbfc4bd320f4a8f03f [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:
Adam Spiers6a5aa7c2013-10-24 11:27:02 +01009#
10# - ``functions`` file
Sean Dague1b6b5312013-07-31 06:46:34 -040011
12# ``stack.sh`` calls the entry points in this order:
13#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010014# - install_oslo
Sean Dague1b6b5312013-07-31 06:46:34 -040015
16# Save trace setting
17XTRACE=$(set +o | grep xtrace)
18set +o xtrace
19
20
21# Defaults
22# --------
23OSLOCFG_DIR=$DEST/oslo.config
24OSLOMSG_DIR=$DEST/oslo.messaging
25
26# Entry Points
27# ------------
28
29# install_oslo() - Collect source and prepare
30function install_oslo() {
Sean Daguedb5fadb2013-08-09 13:41:33 -040031 # TODO(sdague): remove this once we get to Icehouse, this just makes
32 # for a smoother transition of existing users.
33 cleanup_oslo
34
Sean Dague1b6b5312013-07-31 06:46:34 -040035 git_clone $OSLOCFG_REPO $OSLOCFG_DIR $OSLOCFG_BRANCH
36 setup_develop $OSLOCFG_DIR
37
38 git_clone $OSLOMSG_REPO $OSLOMSG_DIR $OSLOMSG_BRANCH
39 setup_develop $OSLOMSG_DIR
40}
41
Sean Daguedb5fadb2013-08-09 13:41:33 -040042# cleanup_oslo() - purge possibly old versions of oslo
43function cleanup_oslo() {
Alessio Ababilovc2a4c922013-08-16 21:53:22 +030044 # this means we've got an old oslo installed, lets get rid of it
Attila Fazekas025fc5e2013-08-13 18:55:33 +020045 if ! python -c 'import oslo.config' 2>/dev/null; then
Sean Daguedb5fadb2013-08-09 13:41:33 -040046 echo "Found old oslo.config... removing to ensure consistency"
47 local PIP_CMD=$(get_pip_command)
Alessio Ababilovc2a4c922013-08-16 21:53:22 +030048 pip_install oslo.config
49 sudo $PIP_CMD uninstall -y oslo.config
Sean Daguedb5fadb2013-08-09 13:41:33 -040050 fi
51}
52
Sean Dague1b6b5312013-07-31 06:46:34 -040053# Restore xtrace
54$XTRACE
55
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010056# Tell emacs to use shell-script-mode
57## Local variables:
58## mode: shell-script
59## End: