Make vmware-nsx capable of handling depends-on

Credits to networking-midonet tox_install* files.

Change-Id: I3ddf84317501ef516a33717b71f66399b9b26875
This commit is contained in:
Armando Migliaccio 2016-11-21 18:08:41 -08:00
parent 4798f3986d
commit a951f5f929
3 changed files with 73 additions and 10 deletions

20
tools/tox_install.sh Executable file
View File

@ -0,0 +1,20 @@
#! /bin/sh
set -e
DIR=$(dirname $0)
${DIR}/tox_install_project.sh neutron neutron $*
${DIR}/tox_install_project.sh networking-l2gw networking_l2gw $*
${DIR}/tox_install_project.sh networking-sfc networking_sfc $*
${DIR}/tox_install_project.sh neutron-lbaas neutron_lbaas $*
${DIR}/tox_install_project.sh tap-as-a-service neutron_taas $*
CONSTRAINTS_FILE=$1
shift
install_cmd="pip install"
if [ $CONSTRAINTS_FILE != "unconstrained" ]; then
install_cmd="$install_cmd -c$CONSTRAINTS_FILE"
fi
$install_cmd -U $*

52
tools/tox_install_project.sh Executable file
View File

@ -0,0 +1,52 @@
#!/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}
PROJ=$1
MOD=$2
shift 2
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
neutron_installed=$(echo "import ${MOD}" | python 2>/dev/null ; echo $?)
BRANCH_NAME=master
set -e
CONSTRAINTS_FILE=$1
shift
install_cmd="pip install"
if [ $CONSTRAINTS_FILE != "unconstrained" ]; then
install_cmd="$install_cmd -c$CONSTRAINTS_FILE"
fi
if [ $neutron_installed -eq 0 ]; then
echo "ALREADY INSTALLED" > /tmp/tox_install-${PROJ}.txt
echo "${PROJ} already installed; using existing package"
elif [ -x "$ZUUL_CLONER" ]; then
echo "ZUUL CLONER" > /tmp/tox_install-${PROJ}.txt
cwd=$(/bin/pwd)
cd /tmp
$ZUUL_CLONER --cache-dir \
/opt/git \
--branch ${BRANCH_NAME} \
git://git.openstack.org \
openstack/${PROJ}
cd openstack/${PROJ}
$install_cmd -e .
cd "$cwd"
else
echo "PIP HARDCODE" > /tmp/tox_install-${PROJ}.txt
$install_cmd -U -egit+https://git.openstack.org/openstack/${PROJ}@${BRANCH_NAME}#egg=${PROJ}
fi

11
tox.ini
View File

@ -8,18 +8,9 @@ setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning PYTHONWARNINGS=default::DeprecationWarning
passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY passenv = TRACE_FAILONLY GENERATE_HASHES http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
usedevelop = True usedevelop = True
install_command = install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
pip install -U -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
# TODO(boden): pulling the egg from git is fine for master, but
# should be replaced with a package version in requirements for
# release (branch) tags
git+https://git.openstack.org/openstack/neutron.git@master#egg=neutron
git+https://git.openstack.org/openstack/networking-l2gw.git@master#egg=networking-l2gw
git+https://git.openstack.org/openstack/networking-sfc.git@master#egg=networking-sfc
git+https://git.openstack.org/openstack/neutron-lbaas.git@master#egg=neutron-lbaas
git+https://git.openstack.org/openstack/tap-as-a-service.git@master#egg=tap-as-a-service
whitelist_externals = sh whitelist_externals = sh
commands = commands =
{toxinidir}/tools/ostestr_compat_shim.sh {posargs} {toxinidir}/tools/ostestr_compat_shim.sh {posargs}