|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | | -# Client constraint file contains this client version pin that is in conflict |
4 | | -# with installing the client from source. We should remove the version pin in |
| 3 | +# Constraint file contains this package version pin that is in conflict |
| 4 | +# with installing the package from source. We should replace the version pin in |
5 | 5 | # the constraints file before applying it for from-source installation. |
6 | 6 |
|
7 | | -CONSTRAINTS_FILE="$1" |
8 | | -shift 1 |
| 7 | +ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner |
| 8 | +BRANCH_NAME=stable/ocata |
| 9 | +PACKAGE_NAME=monasca-ui |
| 10 | +requirements_installed=$(echo "import openstack_requirements" | python 2>/dev/null ; echo $?) |
9 | 11 |
|
10 | 12 | set -e |
11 | 13 |
|
12 | | -# NOTE(tonyb): Place this in the tox enviroment's log dir so it will get |
13 | | -# published to logs.openstack.org for easy debugging. |
14 | | -localfile="$VIRTUAL_ENV/log/upper-constraints.txt" |
| 14 | +git config --global url.https://git.openstack.org/.insteadOf git://git.openstack.org/ |
15 | 15 |
|
16 | | -if [[ "$CONSTRAINTS_FILE" != http* ]]; then |
17 | | - CONSTRAINTS_FILE="file://$CONSTRAINTS_FILE" |
18 | | -fi |
19 | | -# NOTE(tonyb): need to add curl to bindep.txt if the project supports bindep |
20 | | -curl "$CONSTRAINTS_FILE" --insecure --progress-bar --output "$localfile" |
| 16 | +CONSTRAINTS_FILE=$1 |
| 17 | +shift |
21 | 18 |
|
22 | | -pip install -c"$localfile" openstack-requirements |
| 19 | +install_cmd="pip install" |
| 20 | +mydir=$(mktemp -dt "$PACKAGE_NAME-tox_install-XXXXXXX") |
| 21 | +trap "rm -rf $mydir" EXIT |
| 22 | +localfile=$mydir/upper-constraints.txt |
| 23 | +if [[ $CONSTRAINTS_FILE != http* ]]; then |
| 24 | + CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE |
| 25 | +fi |
| 26 | +curl $CONSTRAINTS_FILE -k -o $localfile |
| 27 | +install_cmd="$install_cmd -c$localfile" |
| 28 | + |
| 29 | +if [ $requirements_installed -eq 0 ]; then |
| 30 | + echo "ALREADY INSTALLED" > /tmp/tox_install.txt |
| 31 | + echo "Requirements already installed; using existing package" |
| 32 | +elif [ -x "$ZUUL_CLONER" ]; then |
| 33 | + echo "ZUUL CLONER" > /tmp/tox_install.txt |
| 34 | + pushd $mydir |
| 35 | + $ZUUL_CLONER --cache-dir \ |
| 36 | + /opt/git \ |
| 37 | + --branch $BRANCH_NAME \ |
| 38 | + git://git.openstack.org \ |
| 39 | + openstack/requirements |
| 40 | + cd openstack/requirements |
| 41 | + $install_cmd -e . |
| 42 | + popd |
| 43 | +else |
| 44 | + echo "PIP HARDCODE" > /tmp/tox_install.txt |
| 45 | + if [ -z "$REQUIREMENTS_PIP_LOCATION" ]; then |
| 46 | + REQUIREMENTS_PIP_LOCATION="git+https://git.openstack.org/openstack/requirements@$BRANCH_NAME#egg=requirements" |
| 47 | + fi |
| 48 | + $install_cmd -U -e ${REQUIREMENTS_PIP_LOCATION} |
| 49 | +fi |
23 | 50 |
|
24 | 51 | # This is the main purpose of the script: Allow local installation of |
25 | 52 | # the current repo. It is listed in constraints file and thus any |
26 | 53 | # install will be constrained and we need to unconstrain it. |
27 | | -edit-constraints "$localfile" -- "$CLIENT_NAME" |
| 54 | +edit-constraints $localfile -- $PACKAGE_NAME "-e file://$PWD#egg=$PACKAGE_NAME" |
28 | 55 |
|
29 | | -pip install -c"$localfile" -U "$@" |
| 56 | +$install_cmd -U $* |
30 | 57 | exit $? |
0 commit comments