Permit using arbitrary PyPI urls.

The pypi element is cool, but some folk have local network mirrors
which we should permit them to use.

Change-Id: Ie840ad1184e72b0e01966eee0298cfd6511b6c19
This commit is contained in:
Robert Collins 2014-02-19 14:03:56 +13:00
parent 621376db44
commit 1adf3a377e
3 changed files with 14 additions and 7 deletions

View File

@ -1,13 +1,15 @@
Inject a PyPI mirror
====================
Bind mounts a PyPI mirror from ~/.cache/image-create/pypi/mirror into the build
environment and temporarily overwrites /root/.pip.conf and .pydistutils.cfg to
use it.
Use a custom PyPI mirror to build images. The default is to bind mount one from
~/.cache/image-create/pypi/mirror into the build environment. The element
temporarily overwrites /root/.pip.conf and .pydistutils.cfg to use it.
When online, the master pypi index is supplied as an extra-url, so uncached
dependencies will still be available. When offline, only the mirror is used - a
stale mirror will cause build failures.
When online, the official pypi.python.org pypi index is supplied as an
extra-url, so uncached dependencies will still be available. When offline, only
the mirror is used - be warned that a stale mirror will cause build failures.
To use an arbitrary mirror set PYPI\_MIRROR\_URL=http[s]://somevalue/
[jeepyb](https://git.openstack.org/cgit/openstack-infra/jeepyb) can be useful in making a
partial PyPI mirror suitable for building images. For instance:

View File

@ -2,6 +2,11 @@
set -eu
PYPI_MIRROR_URL=${PYPI_MIRROR_URL:-''}
if [ -n "$PYPI_MIRROR_URL" ]; then
# External mirror URL being used - no need to bind mount anything.
exit 0
fi
MIRROR_SOURCE=~/.cache/image-create/pypi/mirror/
MIRROR_TARGET=$TMP_MOUNT_PATH/tmp/pypi

View File

@ -2,7 +2,7 @@
set -eu
PYPIURL=file:///tmp/pypi
PYPIURL=${PYPI_MIRROR_URL:-'file:///tmp/pypi'}
mkdir -p ~/.pip
if [ -e ~/.pip/pip.conf ]; then