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 Inject a PyPI mirror
==================== ====================
Bind mounts a PyPI mirror from ~/.cache/image-create/pypi/mirror into the build Use a custom PyPI mirror to build images. The default is to bind mount one from
environment and temporarily overwrites /root/.pip.conf and .pydistutils.cfg to ~/.cache/image-create/pypi/mirror into the build environment. The element
use it. 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 When online, the official pypi.python.org pypi index is supplied as an
dependencies will still be available. When offline, only the mirror is used - a extra-url, so uncached dependencies will still be available. When offline, only
stale mirror will cause build failures. 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 [jeepyb](https://git.openstack.org/cgit/openstack-infra/jeepyb) can be useful in making a
partial PyPI mirror suitable for building images. For instance: partial PyPI mirror suitable for building images. For instance:

View File

@ -2,6 +2,11 @@
set -eu 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_SOURCE=~/.cache/image-create/pypi/mirror/
MIRROR_TARGET=$TMP_MOUNT_PATH/tmp/pypi MIRROR_TARGET=$TMP_MOUNT_PATH/tmp/pypi

View File

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