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.

Change-Id: I54d400dea4efdf9ac9b580ff7f0a2bbcceb4df5e
This commit is contained in:
Andreas Jaeger 2016-08-28 08:27:38 +02:00
parent 2d6ac63c52
commit 30ea768a8f
2 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
# Many of neutron's repos suffer from the problem of depending on neutron,
# but it not existing on pypi.
@ -26,10 +26,13 @@ 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
export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH}
echo "ZUUL CLONER" > /tmp/tox_install.txt
cwd=$(/bin/pwd)
cd /tmp
# Make this relative to current working directory so that
# 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 \
/opt/git \
--branch $BRANCH_NAME \
@ -37,7 +40,7 @@ elif [ -x "$ZUUL_CLONER" ]; then
openstack/neutron
cd openstack/neutron
$install_cmd -e .
cd "$cwd"
popd
else
echo "PIP HARDCODE" > /tmp/tox_install.txt
if [ -z "$NEUTRON_PIP_LOCATION" ]; then

View File

@ -52,7 +52,7 @@ commands = python setup.py build_sphinx
ignore = E125,E126,E128,E129,E265,H404,H405,N524,N530
show-source = true
builtins = _
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios,neutron_lbaas/tests/tempest/lib,neutron_lbaas/tests/tempest/v1/api
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.tmp,.ropeproject,rally-scenarios,neutron_lbaas/tests/tempest/lib,neutron_lbaas/tests/tempest/v1/api
[hacking]
import_exceptions = neutron_lbaas._i18n