Skip to content

Commit bcf2abe

Browse files
committed
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
1 parent d73ae10 commit bcf2abe

1 file changed

Lines changed: 49 additions & 25 deletions

File tree

tools/tox_install.sh

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,73 @@
77
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
88
BRANCH_NAME=master
99
CLIENT_NAME=python-openstackclient
10-
requirements_installed=$(echo "import openstack_requirements" | python 2>/dev/null ; echo $?)
10+
GIT_BASE=${GIT_BASE:-https://git.openstack.org/}
11+
12+
install_project() {
13+
local project=$1
14+
local module_name=$2
15+
local branch=${3:-$BRANCH_NAME}
16+
17+
set +e
18+
project_installed=$(echo "import $module_name" | python 2>/dev/null ; echo $?)
19+
set -e
20+
21+
if [ $project_installed -eq 0 ]; then
22+
echo "ALREADY INSTALLED"
23+
echo "$project already installed; using existing package"
24+
elif [ -x "$ZUUL_CLONER" ]; then
25+
echo "ZUUL CLONER"
26+
# Make this relative to current working directory so that
27+
# git clean can remove it. We cannot remove the directory directly
28+
# since it is referenced after $install_cmd -e
29+
PROJECT_DIR=$VIRTUAL_ENV/src
30+
mkdir -p $PROJECT_DIR
31+
pushd $PROJECT_DIR
32+
$ZUUL_CLONER --cache-dir \
33+
/opt/git \
34+
--branch $branch \
35+
http://git.openstack.org \
36+
openstack/$project
37+
cd openstack/$project
38+
$install_cmd -e .
39+
popd
40+
else
41+
echo "PIP HARDCODE"
42+
local GIT_REPO="$GIT_BASE/openstack/$project"
43+
SRC_DIR="$VIRTUAL_ENV/src/openstack/$project"
44+
git clone --depth 1 --branch $branch $GIT_REPO $SRC_DIR
45+
$install_cmd -U -e $SRC_DIR
46+
fi
47+
}
1148

1249
set -e
50+
set -x
1351

1452
CONSTRAINTS_FILE=$1
1553
shift
1654

1755
install_cmd="pip install"
18-
mydir=$(mktemp -dt "$CLIENT_NAME-tox_install-XXXXXXX")
19-
trap "rm -rf $mydir" EXIT
20-
localfile=$mydir/upper-constraints.txt
56+
# NOTE(amotoki): Place this in the tox enviroment's log dir so it will get
57+
# published to logs.openstack.org for easy debugging.
58+
localfile="$VIRTUAL_ENV/log/upper-constraints.txt"
2159
if [[ $CONSTRAINTS_FILE != http* ]]; then
2260
CONSTRAINTS_FILE=file://$CONSTRAINTS_FILE
2361
fi
2462
curl $CONSTRAINTS_FILE -k -o $localfile
2563
install_cmd="$install_cmd -c$localfile"
2664

27-
if [ $requirements_installed -eq 0 ]; then
28-
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
29-
echo "Requirements already installed; using existing package"
30-
elif [ -x "$ZUUL_CLONER" ]; then
31-
echo "ZUUL CLONER" > /tmp/tox_install.txt
32-
pushd $mydir
33-
$ZUUL_CLONER --cache-dir \
34-
/opt/git \
35-
--branch $BRANCH_NAME \
36-
git://git.openstack.org \
37-
openstack/requirements
38-
cd openstack/requirements
39-
$install_cmd -e .
40-
popd
41-
else
42-
echo "PIP HARDCODE" > /tmp/tox_install.txt
43-
if [ -z "$REQUIREMENTS_PIP_LOCATION" ]; then
44-
REQUIREMENTS_PIP_LOCATION="git+https://git.openstack.org/openstack/requirements@$BRANCH_NAME#egg=requirements"
45-
fi
46-
$install_cmd -U -e ${REQUIREMENTS_PIP_LOCATION}
47-
fi
65+
install_project requirements openstack_requirements
4866

4967
# This is the main purpose of the script: Allow local installation of
5068
# the current repo. It is listed in constraints file and thus any
5169
# install will be constrained and we need to unconstrain it.
5270
edit-constraints $localfile -- $CLIENT_NAME "-e file://$PWD#egg=$CLIENT_NAME"
5371

72+
# NOTE(amotoki): In feature/osc4 branch we install osc-lib feature/osc4 branch,
73+
# we install the git version of ocs-lib explicitly
74+
# and specify it in upper-constraints.txt
75+
edit-constraints $localfile -- osc-lib "-e file://$VIRTUAL_ENV/src/openstack/osc-lib#egg=osc-lib"
76+
install_project osc-lib osc_lib feature/osc4
77+
5478
$install_cmd -U $*
5579
exit $?

0 commit comments

Comments
 (0)