Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 3 | # 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 Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 10 | # |
| 11 | # - ``functions`` file |
Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 12 | |
| 13 | # ``stack.sh`` calls the entry points in this order: |
| 14 | # |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 15 | # - install_infra |
Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 16 | |
| 17 | # Save trace setting |
| 18 | XTRACE=$(set +o | grep xtrace) |
| 19 | set +o xtrace |
| 20 | |
| 21 | |
| 22 | # Defaults |
| 23 | # -------- |
Sean Dague | cc52406 | 2014-10-01 09:06:43 -0400 | [diff] [blame] | 24 | GITDIR["pbr"]=$DEST/pbr |
Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 25 | REQUIREMENTS_DIR=$DEST/requirements |
| 26 | |
| 27 | # Entry Points |
| 28 | # ------------ |
| 29 | |
Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 30 | # install_infra() - Collect source and prepare |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 31 | function install_infra { |
Robert Collins | 40f3e33 | 2015-06-19 08:04:00 +1200 | [diff] [blame] | 32 | local PIP_VIRTUAL_ENV="$REQUIREMENTS_DIR/.venv" |
Robert Collins | 8692355 | 2015-06-19 11:17:04 +1200 | [diff] [blame] | 33 | # 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 Collins | 40f3e33 | 2015-06-19 08:04:00 +1200 | [diff] [blame] | 39 | |
Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 40 | # Install pbr |
Sean Dague | cc52406 | 2014-10-01 09:06:43 -0400 | [diff] [blame] | 41 | if use_library_from_git "pbr"; then |
| 42 | git_clone_by_name "pbr" |
| 43 | setup_lib "pbr" |
| 44 | else |
Clark Boylan | 013f52b | 2014-12-23 16:56:15 -0800 | [diff] [blame] | 45 | # Always upgrade pbr to latest version as we may have pulled it |
| 46 | # in via system packages. |
| 47 | pip_install "-U" "pbr" |
Sean Dague | cc52406 | 2014-10-01 09:06:43 -0400 | [diff] [blame] | 48 | fi |
Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | # Restore xtrace |
| 52 | $XTRACE |
| 53 | |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 54 | # Tell emacs to use shell-script-mode |
| 55 | ## Local variables: |
| 56 | ## mode: shell-script |
| 57 | ## End: |