Stop doing any magic cloning of neutron during CI

With https://review.openstack.org/185739 merged to neutron we can no
longer have neutron in requirements.txt

Adopting the solution developed by Doug Wiegley for LBaaS:
c61f920f2a54fd829ee37484b3743ab77b909847

Update how the tools/add_neutron_patches.sh script is invoked.

Change-Id: I0df48369bdc9de22be51af4e7c4ea9ce4255cd2a
This commit is contained in:
Henry Gessau
2015-07-01 21:29:47 +00:00
parent 482eaad244
commit 36b10b2baf
4 changed files with 53 additions and 9 deletions

View File

@@ -4,4 +4,3 @@
pbr>=0.6,!=0.7,<1.0
Babel>=1.3
-e git://git.openstack.org/openstack/neutron.git#egg=neutron

View File

@@ -2,17 +2,17 @@
echo "Adding neutron patches into the testing env"
DIRECTORY="$1/src/neutron"
NEUTRON_SRC="$1"
LIST_SRC="$2/test-patches.txt"
echo "Checking Directory Existance: $DIRECTORY"
echo "Checking Directory Existence: $NEUTRON_SRC"
if [ ! -d "$DIRECTORY" ]; then
echo "Directory $DIRECTORY does not exist, aborting..."
if [ ! -d "$NEUTRON_SRC" ]; then
echo "Directory $NEUTRON_SRC does not exist, aborting..."
exit 1
fi
cd $DIRECTORY
cd $NEUTRON_SRC
# Ensure we're on toxBranch not master or other branches
git checkout -b toxBranch 2> /dev/null

45
tools/tox_install.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/sh
# Many of neutron's repos suffer from the problem of depending on neutron,
# but it not existing on pypi.
# This wrapper for tox's package installer will use the existing package
# if it exists, else use zuul-cloner if that program exists, else grab it
# from neutron master via a hard-coded URL. That last case should only
# happen with devs running unit tests locally.
# From the tox.ini config page:
# install_command=ARGV
# default:
# pip install {opts} {packages}
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
set -ex
cwd=$(/bin/pwd)
if [ $neutron_installed -eq 0 ]; then
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
echo "Neutron already installed; using existing package"
elif [ -x "$ZUUL_CLONER" ]; then
echo "ZUUL CLONER" > /tmp/tox_install.txt
cd /tmp
$ZUUL_CLONER --cache-dir \
/opt/git \
git://git.openstack.org \
openstack/neutron
cd openstack/neutron
$cwd/tools/add_neutron_patches.sh /tmp/openstack/neutron $cwd
pip install -e .
cd "$cwd"
else
echo "PIP HARDCODE" > /tmp/tox_install.txt
pip install -U -egit+https://git.openstack.org/openstack/neutron#egg=neutron
$cwd/tools/add_neutron_patches.sh $VIRTUAL_ENV/src/neutron $cwd
pip install -U -e $VIRTUAL_ENV/src/neutron
fi
pip install -U $*
exit $?

View File

@@ -9,11 +9,11 @@ skipsdist = True
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
usedevelop = True
install_command = pip install -r requirements.txt -U {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
install_command = {toxinidir}/tools/tox_install.sh {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
whitelist_externals = sh
commands =
sh {toxinidir}/tools/add_neutron_patches.sh {envdir} {toxinidir}
sh tools/pretty_tox.sh '{posargs}'
# there is also secret magic in pretty_tox.sh which lets you run in a fail only
# mode. To do this define the TRACE_FAILONLY environmental variable.