| 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 | 
| Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 18 | _XTRACE_INFRA=$(set +o | grep xtrace) | 
| Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 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 |  | 
|  | 26 | # Entry Points | 
|  | 27 | # ------------ | 
|  | 28 |  | 
| Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 29 | # install_infra() - Collect source and prepare | 
| Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 30 | function install_infra { | 
| Robert Collins | 40f3e33 | 2015-06-19 08:04:00 +1200 | [diff] [blame] | 31 | local PIP_VIRTUAL_ENV="$REQUIREMENTS_DIR/.venv" | 
| Robert Collins | 8692355 | 2015-06-19 11:17:04 +1200 | [diff] [blame] | 32 | [ ! -d $PIP_VIRTUAL_ENV ] && virtualenv $PIP_VIRTUAL_ENV | 
|  | 33 | # We don't care about testing git pbr in the requirements venv. | 
|  | 34 | PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install -U pbr | 
|  | 35 | PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install $REQUIREMENTS_DIR | 
| Robert Collins | 40f3e33 | 2015-06-19 08:04:00 +1200 | [diff] [blame] | 36 |  | 
| Robert Collins | 7ebe8e0 | 2015-06-23 09:41:21 +1200 | [diff] [blame] | 37 | # Unset the PIP_VIRTUAL_ENV so that PBR does not end up trapped | 
|  | 38 | # down the VENV well | 
|  | 39 | unset PIP_VIRTUAL_ENV | 
|  | 40 |  | 
| Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 41 | # Install pbr | 
| Sean Dague | cc52406 | 2014-10-01 09:06:43 -0400 | [diff] [blame] | 42 | if use_library_from_git "pbr"; then | 
|  | 43 | git_clone_by_name "pbr" | 
| Sean Dague | 2105b9f | 2015-09-10 14:01:40 -0400 | [diff] [blame] | 44 | setup_dev_lib "pbr" | 
| Sean Dague | cc52406 | 2014-10-01 09:06:43 -0400 | [diff] [blame] | 45 | else | 
| Clark Boylan | 013f52b | 2014-12-23 16:56:15 -0800 | [diff] [blame] | 46 | # Always upgrade pbr to latest version as we may have pulled it | 
|  | 47 | # in via system packages. | 
|  | 48 | pip_install "-U" "pbr" | 
| Sean Dague | cc52406 | 2014-10-01 09:06:43 -0400 | [diff] [blame] | 49 | fi | 
| Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 50 | } | 
|  | 51 |  | 
|  | 52 | # Restore xtrace | 
| Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 53 | $_XTRACE_INFRA | 
| Sean Dague | 0392a10 | 2013-07-31 13:07:45 -0400 | [diff] [blame] | 54 |  | 
| Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 55 | # Tell emacs to use shell-script-mode | 
|  | 56 | ## Local variables: | 
|  | 57 | ## mode: shell-script | 
|  | 58 | ## End: |