From 30ea768a8f83c76494b0c51caa948d1e68b3675d Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Sun, 28 Aug 2016 08:27:38 +0200 Subject: [PATCH] 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 --- tools/tox_install.sh | 13 ++++++++----- tox.ini | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/tox_install.sh b/tools/tox_install.sh index 3acf392fa..00223e915 100755 --- a/tools/tox_install.sh +++ b/tools/tox_install.sh @@ -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 diff --git a/tox.ini b/tox.ini index 00cf2a069..d40f58a81 100644 --- a/tox.ini +++ b/tox.ini @@ -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