From 658b7b9d47cb05fa43383b5bdf3beea0dc99b886 Mon Sep 17 00:00:00 2001 From: ohemorange Date: Thu, 24 Jan 2019 10:03:52 -0800 Subject: [PATCH] Add VIRTUALENV_NO_DOWNLOAD=1 to all calls to virtualenv (#6690) This will immediately address the breakage reported in #6682 and tracked at #6685. Virtualenv downloads the latest pip, which causes issues, so tell virtualenv to not download the latest pip. I added the flag preemptively to other files as well, they're in separate commits so it will be easy to revert any spots we don't want. I've confirmed that this fixes the issue on a machine that fails with the version of certbot-auto currently in master: recent version of virtualenv, python 2.7. * Update changelog * Use an environment variable instead of a flag for compatibility with old versions * Run build.py --- CHANGELOG.md | 2 ++ Dockerfile-old | 2 +- certbot-compatibility-test/Dockerfile | 2 +- letsencrypt-auto-source/letsencrypt-auto | 6 ++++-- letsencrypt-auto-source/letsencrypt-auto.template | 6 ++++-- tools/_release.sh | 4 ++-- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1861e38bf..9640d662f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ Certbot adheres to [Semantic Versioning](https://semver.org/). * Fixed accessing josepy contents through acme.jose when the full acme.jose path is used. * Clarify behavior for deleting certs as part of revocation. +* Add VIRTUALENV_NO_DOWNLOAD=1 to all calls to virtualenv to address breakages + from venv downloading the latest pip Despite us having broken lockstep, we are continuing to release new versions of all Certbot components during releases for the time being, however, the only diff --git a/Dockerfile-old b/Dockerfile-old index da48c7fc8..c52a9937b 100644 --- a/Dockerfile-old +++ b/Dockerfile-old @@ -51,7 +51,7 @@ COPY certbot-apache /opt/certbot/src/certbot-apache/ COPY certbot-nginx /opt/certbot/src/certbot-nginx/ -RUN virtualenv --no-site-packages -p python2 /opt/certbot/venv +RUN VIRTUALENV_NO_DOWNLOAD=1 virtualenv --no-site-packages -p python2 /opt/certbot/venv # PATH is set now so pipstrap upgrades the correct (v)env ENV PATH /opt/certbot/venv/bin:$PATH diff --git a/certbot-compatibility-test/Dockerfile b/certbot-compatibility-test/Dockerfile index cbbdf7193..1e9e0d727 100644 --- a/certbot-compatibility-test/Dockerfile +++ b/certbot-compatibility-test/Dockerfile @@ -31,7 +31,7 @@ COPY certbot-nginx /opt/certbot/src/certbot-nginx/ COPY certbot-compatibility-test /opt/certbot/src/certbot-compatibility-test/ COPY tools /opt/certbot/src/tools -RUN virtualenv --no-site-packages -p python2 /opt/certbot/venv && \ +RUN VIRTUALENV_NO_DOWNLOAD=1 virtualenv --no-site-packages -p python2 /opt/certbot/venv && \ /opt/certbot/venv/bin/pip install -U setuptools && \ /opt/certbot/venv/bin/pip install -U pip ENV PATH /opt/certbot/venv/bin:$PATH diff --git a/letsencrypt-auto-source/letsencrypt-auto b/letsencrypt-auto-source/letsencrypt-auto index d86401904..02f6b810b 100755 --- a/letsencrypt-auto-source/letsencrypt-auto +++ b/letsencrypt-auto-source/letsencrypt-auto @@ -945,10 +945,12 @@ if [ "$1" = "--le-auto-phase2" ]; then DeterminePythonVersion rm -rf "$VENV_PATH" if [ "$PYVER" -le 27 ]; then + # Use an environment variable instead of a flag for compatibility with old versions if [ "$VERBOSE" = 1 ]; then - virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" + VIRTUALENV_NO_DOWNLOAD=1 virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" else - virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" > /dev/null + VIRTUALENV_NO_DOWNLOAD=1 virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" \ + > /dev/null fi else if [ "$VERBOSE" = 1 ]; then diff --git a/letsencrypt-auto-source/letsencrypt-auto.template b/letsencrypt-auto-source/letsencrypt-auto.template index f431e32e4..2cd3f4336 100755 --- a/letsencrypt-auto-source/letsencrypt-auto.template +++ b/letsencrypt-auto-source/letsencrypt-auto.template @@ -537,10 +537,12 @@ if [ "$1" = "--le-auto-phase2" ]; then DeterminePythonVersion rm -rf "$VENV_PATH" if [ "$PYVER" -le 27 ]; then + # Use an environment variable instead of a flag for compatibility with old versions if [ "$VERBOSE" = 1 ]; then - virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" + VIRTUALENV_NO_DOWNLOAD=1 virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" else - virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" > /dev/null + VIRTUALENV_NO_DOWNLOAD=1 virtualenv --no-site-packages --python "$LE_PYTHON" "$VENV_PATH" \ + > /dev/null fi else if [ "$VERBOSE" = 1 ]; then diff --git a/tools/_release.sh b/tools/_release.sh index ec2deda22..d75a0f487 100755 --- a/tools/_release.sh +++ b/tools/_release.sh @@ -42,7 +42,7 @@ mv "dist.$version" "dist.$version.$(date +%s).bak" || true git tag --delete "$tag" || true tmpvenv=$(mktemp -d) -virtualenv --no-site-packages -p python2 $tmpvenv +VIRTUALENV_NO_DOWNLOAD=1 virtualenv --no-site-packages -p python2 $tmpvenv . $tmpvenv/bin/activate # update setuptools/pip just like in other places in the repo pip install -U setuptools @@ -135,7 +135,7 @@ cd "dist.$version" python -m SimpleHTTPServer $PORT & # cd .. is NOT done on purpose: we make sure that all subpackages are # installed from local PyPI rather than current directory (repo root) -virtualenv --no-site-packages ../venv +VIRTUALENV_NO_DOWNLOAD=1 virtualenv --no-site-packages ../venv . ../venv/bin/activate pip install -U setuptools pip install -U pip