summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Hoge <chris@openstack.org>2019-02-12 21:53:34 +0000
committerChris Hoge <chris@openstack.org>2019-02-12 22:01:45 +0000
commitae6db7a387f8a2a779c5e9c33830d1f8d8af7971 (patch)
treedb9420e86156060af6a9c3960637ef731f343891
parent432503259f5e624afdabd9dacc9d9b367dd95e96 (diff)
Fix broken symlinks from virtualenv 16.4.0 update
The virtualenv 16.4.0 updates fixes the handling of creating symlinks of libraries to existing installations. Previously, virtualenv would copy existing libraries into the virtualenv making nested environments possible without retaining the "parent" virtualenv. Now virtualenv builds a symlink chain, which means we need to preserve the bootstrap virtualenv that gives us an up-to-date installation of pip and virtualenv. As distributions update their default virtualenv installations, we might be able to use the --always-copy flag to stop using symlinks and just copy dependencies over directly. However, the virtualenv that ships with CentOS has a bug that causes the use of that flag to fail, meaning as of right now we can't use it to boostrap pip. This patch moves the boostrap virtualenv from /tmp/venv, where it is deleted in the build process, to /var/lib/pipboostrap, where the symlink chain from /var/lib/openstack -> /var/lib/pipbootstrap -> /usr/lib will be remain unbroken. Change-Id: I99124c2cfeb6ba7468a034ab510071eb67d98d66
Notes
Notes (review): Code-Review+2: Jean-Philippe Evrard <jean-philippe@evrard.me> Code-Review+2: Chris Hoge <chris@openstack.org> Workflow+1: Chris Hoge <chris@openstack.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 15 Feb 2019 17:42:07 +0000 Reviewed-on: https://review.openstack.org/636447 Project: openstack/loci Branch: refs/heads/master
-rwxr-xr-xscripts/setup_pip.sh28
1 files changed, 22 insertions, 6 deletions
diff --git a/scripts/setup_pip.sh b/scripts/setup_pip.sh
index 292d748..6edc367 100755
--- a/scripts/setup_pip.sh
+++ b/scripts/setup_pip.sh
@@ -2,6 +2,7 @@
2 2
3set -ex 3set -ex
4 4
5
5if [[ "${PYTHON3}" == "no" ]]; then 6if [[ "${PYTHON3}" == "no" ]]; then
6 TMP_VIRTUALENV="virtualenv" 7 TMP_VIRTUALENV="virtualenv"
7else 8else
@@ -13,12 +14,27 @@ fi
13if (( $(${TMP_VIRTUALENV} --version | cut -d. -f1) >= 14 )); then 14if (( $(${TMP_VIRTUALENV} --version | cut -d. -f1) >= 14 )); then
14 SETUPTOOLS="--no-setuptools" 15 SETUPTOOLS="--no-setuptools"
15fi 16fi
16${TMP_VIRTUALENV} --extra-search-dir=/tmp/wheels ${SETUPTOOLS} /tmp/venv
17source /tmp/venv/bin/activate
18 17
19# TODO: Remove virtualenv version pinning once a suitable fix is found 18# virtualenv 16.4.0 fixed symlink handling. The interaction of the new
20# to this issue: 19# corrected behavior with legacy bugs in packaged virtualenv releases in
21# http://lists.openstack.org/pipermail/openstack-discuss/2019-February/002592.html 20# distributions means we need to hold on to the pip bootstrap installation
22pip install --upgrade ${PIP_ARGS} virtualenv==16.3.0 21# chain to preserve symlinks. As distributions upgrade their default
22# installations we may not need this workaround in the future
23PIPBOOTSTRAP=/var/lib/pipbootstrap
24
25# Create the boostrap environment so we can get pip from virtualenv
26${TMP_VIRTUALENV} --extra-search-dir=/tmp/wheels ${SETUPTOOLS} ${PIPBOOTSTRAP}
27source ${PIPBOOTSTRAP}/bin/activate
28
29# Upgrade to the latest version of virtualenv
30pip install --upgrade ${PIP_ARGS} virtualenv
31
32# Forget the cached locations of python binaries
23hash -r 33hash -r
34
35# Create the virtualenv with the updated toolchain for openstack service
24virtualenv --extra-search-dir=/tmp/wheels /var/lib/openstack 36virtualenv --extra-search-dir=/tmp/wheels /var/lib/openstack
37
38# Deactivate the old bootstrap virtualenv and switch to the new one
39deactivate
40source /var/lib/openstack/bin/activate