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. Also, remove setup of ZUUL_BRANCH, this is not needed with current zuul anymore. Sync file with neutron-lbaas. Change-Id: Id56b9b70fb9c4113f4641e5b3f35ab63cfff6d4e
This commit is contained in:
@@ -13,28 +13,29 @@
|
||||
# default:
|
||||
# pip install {opts} {packages}
|
||||
|
||||
set -x
|
||||
|
||||
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
|
||||
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
|
||||
NEUTRON_DIR=$HOME/neutron
|
||||
BRANCH_NAME=master
|
||||
neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
|
||||
|
||||
set -e
|
||||
|
||||
install_cmd="pip install -c$1"
|
||||
shift
|
||||
|
||||
if [ -d "$NEUTRON_DIR" ]; then
|
||||
echo "FOUND Neutron code at $NEUTRON_DIR - using"
|
||||
$install_cmd -U -e $NEUTRON_DIR
|
||||
elif [ $neutron_installed -eq 0 ]; then
|
||||
if [ $neutron_installed -eq 0 ]; then
|
||||
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
|
||||
location=$(python -c "import neutron; print(neutron.__file__)")
|
||||
echo "ALREADY INSTALLED at $location"
|
||||
|
||||
echo "Neutron already installed; using existing package"
|
||||
elif [ -x "$ZUUL_CLONER" ]; then
|
||||
echo "USING ZUUL CLONER to obtain Neutron code"
|
||||
cwd=$(/bin/pwd)
|
||||
cd /tmp
|
||||
echo "ZUUL CLONER" > /tmp/tox_install.txt
|
||||
# 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 \
|
||||
@@ -42,10 +43,13 @@ elif [ -x "$ZUUL_CLONER" ]; then
|
||||
openstack/neutron
|
||||
cd openstack/neutron
|
||||
$install_cmd -e .
|
||||
cd "$cwd"
|
||||
popd
|
||||
else
|
||||
echo "LOCAL - Obtaining Neutron code from git.openstack.org"
|
||||
$install_cmd -U -egit+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron
|
||||
echo "PIP HARDCODE" > /tmp/tox_install.txt
|
||||
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
|
||||
|
||||
$install_cmd -U $*
|
||||
|
2
tox.ini
2
tox.ini
@@ -89,7 +89,7 @@ commands = sphinx-build -W -b html doc/source doc/build
|
||||
# N530 direct neutron imports not allowed
|
||||
ignore = E125,E126,E128,E129,E265,H404,H405,N530
|
||||
show-source = true
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
||||
exclude = .venv,.git,.tox,dist,doc,.tmp,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
||||
|
||||
[hacking]
|
||||
import_exceptions = neutron_vpnaas._i18n
|
||||
|
Reference in New Issue
Block a user