2013-08-09 13:13:15 +00:00
|
|
|
Inject a PyPI mirror
|
|
|
|
====================
|
|
|
|
|
2014-02-19 01:03:56 +00:00
|
|
|
Use a custom PyPI mirror to build images. The default is to bind mount one from
|
2014-05-26 02:20:50 +00:00
|
|
|
~/.cache/image-create/pypi/mirror into the build environment as mirror URL
|
|
|
|
file:///tmp/pypi. The element temporarily overwrites /root/.pip.conf
|
|
|
|
and .pydistutils.cfg to use it.
|
2013-08-09 13:13:15 +00:00
|
|
|
|
2014-02-19 01:03:56 +00:00
|
|
|
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.
|
2014-03-25 03:44:46 +00:00
|
|
|
To disable the pypi.python.org index without using --offline (e.g. when working
|
|
|
|
behind a corporate firewall that prohibits pypi.python.org) set
|
|
|
|
DIB\_NO\_PYPI\_PIP to any non-empty value.
|
2014-02-19 01:03:56 +00:00
|
|
|
|
|
|
|
To use an arbitrary mirror set PYPI\_MIRROR\_URL=http[s]://somevalue/
|
2013-08-09 13:13:15 +00:00
|
|
|
|
2014-03-25 03:44:46 +00:00
|
|
|
Additional mirrors can be added by exporting PYPI\_MIRROR\_URL\_1=... etc. Only
|
|
|
|
the one mirror can be used by easy-install, but since wheels need to be in the
|
|
|
|
first mirror to be used, the last listed mirror is used as the pydistutils
|
|
|
|
index. NB: The sort order for these variables is a simple string sort - if
|
|
|
|
you have more than 9 additional mirrors, some care will be needed.
|
|
|
|
|
|
|
|
A typical use of this element is thus:
|
|
|
|
export PYPI\_MIRROR\_URL=http://site/pypi/Ubuntu-13.10
|
|
|
|
export PYPI\_MIRROR\_URL\_1=http://site/pypi/
|
2014-05-26 02:20:50 +00:00
|
|
|
export PYPI\_MIRROR\_URL\_2=file:///tmp/pypi
|
2014-03-25 03:44:46 +00:00
|
|
|
|
|
|
|
[pypi-mirror](https://git.openstack.org/cgit/openstack-infra/pypi-mirror) can
|
|
|
|
be useful in making a partial PyPI mirror suitable for building images. For
|
|
|
|
instance:
|
2013-08-09 13:13:15 +00:00
|
|
|
|
|
|
|
* sudo apt-get install libxml2-dev libxslt-dev libmysqlclient-dev libpq-dev \
|
|
|
|
libnspr4-dev pkg-config libsqlite3-dev libzmq-dev libffi-dev libldap2-dev \
|
|
|
|
libsasl2-dev
|
|
|
|
|
2014-02-19 12:10:38 +00:00
|
|
|
* pip install git+https://git.openstack.org/openstack-infra/pypi-mirror
|
2013-08-09 13:13:15 +00:00
|
|
|
|
|
|
|
* cat << EOF > mirror.yaml
|
|
|
|
cache-root: /home/USER/.cache/image-create/pypi/download
|
|
|
|
|
|
|
|
mirrors:
|
|
|
|
- name: openstack
|
|
|
|
projects:
|
2013-09-18 13:17:10 +00:00
|
|
|
- https://git.openstack.org/openstack/requirements
|
2013-08-09 13:13:15 +00:00
|
|
|
output: /home/USER/.cache/image-create/pypi/mirror
|
2013-08-12 21:51:01 +00:00
|
|
|
EOF
|
2013-08-09 13:13:15 +00:00
|
|
|
|
|
|
|
* mkdir -p /home/USER/.cache/image-create/pypi/{download,mirror}
|
|
|
|
|
|
|
|
* run-mirror -b remotes/origin/master --verbose -c mirror.yaml
|
|
|
|
# This creates and updates the mirror.
|
|
|
|
|
|
|
|
If you have additional packages that are not identified in the global openstack
|
|
|
|
requirements project, you can include them:
|
|
|
|
|
|
|
|
* pip install -d ~/.cache/image-create/pypi/download/pip/openstack \
|
|
|
|
heat-cfntools distribute os-apply-config
|
|
|
|
run-mirror -b remotes/origin/master --verbose -c mirror.yaml --no-download
|
2014-04-01 09:16:20 +00:00
|
|
|
|
|
|
|
A dedicated user with no privileges may be desirable when running this for
|
|
|
|
unattended installs, since pypi-mirror will compile fairly arbitrary code from
|
|
|
|
the internet.
|