Use temporary directory for neutron install
Do not install in /tmp/openstack/neutron and leave the git repository there after the script is run - if zuul-cloner is used. We run jobs on long lived workers and also on developers machines, let's cleanup afterwards. Install into a temporary directory that can be removed with "git clean" afterwards. Add this directory to ignore list of pep8. Simplify with using pushd/popd which are bash features, so change she-bang. Also, remove setup of ZUUL_BRANCH, this is not needed with current zuul anymore. Move over some changes from neutron-lbaas so that these two are in sync. Change-Id: I894cf28910c0969a8f7920f5b34c34ca0d5658b2
This commit is contained in:
parent
bc5af7c581
commit
82473d3d93
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Many of neutron's repos suffer from the problem of depending on neutron,
|
# Many of neutron's repos suffer from the problem of depending on neutron,
|
||||||
# but it not existing on pypi.
|
# but it not existing on pypi.
|
||||||
|
@ -8,9 +8,14 @@
|
||||||
# from neutron master via a hard-coded URL. That last case should only
|
# from neutron master via a hard-coded URL. That last case should only
|
||||||
# happen with devs running unit tests locally.
|
# 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
|
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
|
||||||
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
|
|
||||||
BRANCH_NAME=master
|
BRANCH_NAME=master
|
||||||
|
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -22,8 +27,12 @@ if [ $neutron_installed -eq 0 ]; then
|
||||||
echo "Neutron already installed; using existing package"
|
echo "Neutron already installed; using existing package"
|
||||||
elif [ -x "$ZUUL_CLONER" ]; then
|
elif [ -x "$ZUUL_CLONER" ]; then
|
||||||
echo "ZUUL CLONER" > /tmp/tox_install.txt
|
echo "ZUUL CLONER" > /tmp/tox_install.txt
|
||||||
cwd=$(/bin/pwd)
|
# Make this relative to current working directory so that
|
||||||
cd /tmp
|
# git clean can remove it. We cannot remove the directory directly
|
||||||
|
# since it is reference after $install_cmd -e.
|
||||||
|
mkdir -p .tmp
|
||||||
|
NEUTRON_DIR=$(/bin/mktemp -d -p $(pwd)/.tmp)
|
||||||
|
pushd $NEUTRON_DIR
|
||||||
$ZUUL_CLONER --cache-dir \
|
$ZUUL_CLONER --cache-dir \
|
||||||
/opt/git \
|
/opt/git \
|
||||||
--branch $BRANCH_NAME \
|
--branch $BRANCH_NAME \
|
||||||
|
@ -31,10 +40,13 @@ elif [ -x "$ZUUL_CLONER" ]; then
|
||||||
openstack/neutron
|
openstack/neutron
|
||||||
cd openstack/neutron
|
cd openstack/neutron
|
||||||
$install_cmd -e .
|
$install_cmd -e .
|
||||||
cd "$cwd"
|
popd
|
||||||
else
|
else
|
||||||
echo "PIP HARDCODE" > /tmp/tox_install.txt
|
echo "PIP HARDCODE" > /tmp/tox_install.txt
|
||||||
$install_cmd -U -egit+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron
|
if [ -z "$NEUTRON_PIP_LOCATION" ]; then
|
||||||
|
NEUTRON_PIP_LOCATION="git+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron"
|
||||||
|
fi
|
||||||
|
$install_cmd -U -e ${NEUTRON_PIP_LOCATION}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$install_cmd -U $*
|
$install_cmd -U $*
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -89,7 +89,7 @@ commands = python setup.py build_sphinx
|
||||||
# N530 direct neutron imports not allowed
|
# N530 direct neutron imports not allowed
|
||||||
ignore = E125,E126,E128,E129,E265,H404,H405,N530
|
ignore = E125,E126,E128,E129,E265,H404,H405,N530
|
||||||
show-source = true
|
show-source = true
|
||||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,.tmp,*egg,build,tools,.ropeproject,rally-scenarios
|
||||||
|
|
||||||
[testenv:pylint]
|
[testenv:pylint]
|
||||||
deps =
|
deps =
|
||||||
|
|
Loading…
Reference in New Issue