summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiro Motoki <amotoki@gmail.com>2017-08-01 18:03:34 +0000
committerAkihiro Motoki <amotoki@gmail.com>2017-08-02 22:16:53 +0000
commitbcf2abe08a08138f0099ecaa19fe57ca5cc93bc1 (patch)
tree68932cadd154e51f07fa33a6003e74ce78ed9725
parentd73ae104b39772db112412f3b744c98fd1c8de96 (diff)
downloadpython-openstackclient-bcf2abe08a08138f0099ecaa19fe57ca5cc93bc1.tar.gz
upper-constraints setup for osc4 branch
I think we would like to install both osc-lib and OSC from feature/osc4 branch not to use osc-lib constrainted by upper-constraints.txt file. This tweaks tox_install.sh to install both from the git repos and it also supports Depends-On. Change-Id: I08532078cd5d83a6d720627522220f9108772539
-rwxr-xr-xtools/tox_install.sh74
1 files changed, 49 insertions, 25 deletions
diff --git a/tools/tox_install.sh b/tools/tox_install.sh
index 4af3be16..96e0c121 100755
--- a/tools/tox_install.sh
+++ b/tools/tox_install.sh
@@ -7,49 +7,73 @@
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
BRANCH_NAME=master
CLIENT_NAME=python-openstackclient
-requirements_installed=$(echo "import openstack_requirements" | python 2>/dev/null ; echo $?)
+GIT_BASE=${GIT_BASE:-https://git.openstack.org/}
+
+install_project() {
+ local project=$1
+ local module_name=$2
+ local branch=${3:-$BRANCH_NAME}
+
+ set +e
+ project_installed=$(echo "import $module_name" | python 2>/dev/null ; echo $?)
+ set -e
+
+ if [ $project_installed -eq 0 ]; then
+ echo "ALREADY INSTALLED"
+ echo "$project already installed; using existing package"
+ elif [ -x "$ZUUL_CLONER" ]; then
+ echo "ZUUL CLONER"
+ # Make this relative to current working directory so that
+ # git clean can remove it. We cannot remove the directory directly
+ # since it is referenced after $install_cmd -e
+ PROJECT_DIR=$VIRTUAL_ENV/src
+ mkdir -p $PROJECT_DIR
+ pushd $PROJECT_DIR
+ $ZUUL_CLONER --cache-dir \
+ /opt/git \
+ --branch $branch \
+ http://git.openstack.org \
+ openstack/$project
+ cd openstack/$project
+ $install_cmd -e .
+ popd
+ else
+ echo "PIP HARDCODE"
+ local GIT_REPO="$GIT_BASE/openstack/$project"
+ SRC_DIR="$VIRTUAL_ENV/src/openstack/$project"
+ git clone --depth 1 --branch $branch $GIT_REPO $SRC_DIR
+ $install_cmd -U -e $SRC_DIR
+ fi
+}
set -e
+set -x
CONSTRAINTS_FILE=$1
shift
install_cmd="pip install"
-mydir=$(mktemp -dt "$CLIENT_NAME-tox_install-XXXXXXX")
-trap "rm -rf $mydir" EXIT
-localfile=$mydir/upper-constraints.txt
+# NOTE(amotoki): Place this in the tox enviroment's log dir so it will get
+# published to logs.openstack.org for easy debugging.
+localfile="$VIRTUAL_ENV/log/upper-constraints.txt"
if [[ $CONSTRAINTS_FILE != http* ]]; then
CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE
fi
curl $CONSTRAINTS_FILE -k -o $localfile
install_cmd="$install_cmd -c$localfile"
-if [ $requirements_installed -eq 0 ]; then
- echo "ALREADY INSTALLED" > /tmp/tox_install.txt
- echo "Requirements already installed; using existing package"
-elif [ -x "$ZUUL_CLONER" ]; then
- echo "ZUUL CLONER" > /tmp/tox_install.txt
- pushd $mydir
- $ZUUL_CLONER --cache-dir \
- /opt/git \
- --branch $BRANCH_NAME \
- git://git.openstack.org \
- openstack/requirements
- cd openstack/requirements
- $install_cmd -e .
- popd
-else
- echo "PIP HARDCODE" > /tmp/tox_install.txt
- if [ -z "$REQUIREMENTS_PIP_LOCATION" ]; then
- REQUIREMENTS_PIP_LOCATION="git+https://git.openstack.org/openstack/requirements@$BRANCH_NAME#egg=requirements"
- fi
- $install_cmd -U -e ${REQUIREMENTS_PIP_LOCATION}
-fi
+install_project requirements openstack_requirements
# This is the main purpose of the script: Allow local installation of
# the current repo. It is listed in constraints file and thus any
# install will be constrained and we need to unconstrain it.
edit-constraints $localfile -- $CLIENT_NAME "-e file://$PWD#egg=$CLIENT_NAME"
+# NOTE(amotoki): In feature/osc4 branch we install osc-lib feature/osc4 branch,
+# we install the git version of ocs-lib explicitly
+# and specify it in upper-constraints.txt
+edit-constraints $localfile -- osc-lib "-e file://$VIRTUAL_ENV/src/openstack/osc-lib#egg=osc-lib"
+install_project osc-lib osc_lib feature/osc4
+
$install_cmd -U $*
exit $?