diskimage-builder/elements/source-repositories
Steve Baker 9e5bc37265 Add support for file to source-repositories
Adds a file type to source-repositories to allow individual files
to make use of source-repositories caching.

REPO_DIRECTORY has been rename to REPO_DEST since it is now sometimes
a file.

This change also fixes the incorrect path to the cache-url in the
tar type.

Change-Id: Ib79e41969c982a02f0235318d9f254b39c3c6d93
2013-09-04 10:16:49 +12:00
..
extra-data.d Add support for file to source-repositories 2013-09-04 10:16:49 +12:00
install.d Install git with source-repositories element. 2013-06-20 14:47:08 +01:00
element-deps Cache repository-sources data. 2013-07-18 22:40:23 +12:00
README.md Capture the repositories from source-repositories. 2013-08-05 09:52:28 +12:00

With this element other elements can register source code repositories by placing their details in the file source-repository-*. An example of an element "custom-element" that wants to retrieve the ironic source from git and pbr from a tarball would be

File : elements/custom-element/source-repository-ironic

#<name> <type> <destination> <location> [<ref>]
# <ref> defaults to master if not specified
ironic git /usr/local/ironic git://github.com/openstack/ironic.git

File : elements/custom-element/source-repository-pbr

pbr tar /usr/local/pbr http://tarballs.openstack.org/pbr/pbr-master.tar.gz

diskimage-builder will then retrieve the sources specified and place them at the directory <destination>

A number of environment variables can be set by the process calling diskimage-builder which can change the details registered by the element, these are

DIB_REPOTYPE_<name>     : change the registered type
DIB_REPOLOCATION_<name> : change the registered location
DIB_REPOREF_<name>      : change the registered reference

for example if you would like diskimage-builder to get ironic from a local mirror you could set DIB_REPOLOCATION_ironic=git://localgitserver/ironic.git

Alternatively if you would like to use the keystone element and build an image with keystone from a stable branch then you would set DIB_REPOREF_keystone=stable/grizzly

Git sources will be cloned to <destination>

Tarballs will be extracted to <destination>. Tarballs should contain a single topleval directory, regardless of the name of this top level directory it will be renamed to <destination>

If mulitple elements register a source location with the same then source-repositories will exit with an error. Care should therefore be taken to only use elements together that download source to different locations.

The repository paths built into the image are stored in etc/dib-source-repositories, one repository per line. This permits later review of the repositories (by users or by other elements).