Equinox/p2/Composite Repositories (new)
As repositories continually grow in size they become harder to manage. The goal of composite repositories is to make this task easier by allowing you to have a parent repository which refers to multiple children. Users are then able to reference the parent repository and the children's content will transparently be available to them.
How It Works
With the built-in repository types defined by p2, when a user connects to a server we check to see if there are any files that we recognize. In particular for metadata repositories we look for a
content.xml file or a
content.jar and in the case of artifact repositories we look for an
So in order to create a composite repository, all you need to do is create a new file (
compositeArtifacts.xml/compositeArtifacts.jar) and p2 will recognize that you have defined a composite repository and load it from there.
Sample Composite Metadata Repository
In the sample files below there is a parent repository with two children. Note that the physical location of the children (in this example) are relative paths which are sub-folders of the parent. For instance, if the location of the parent is
http://example.eclipse.org/updates then the children are
http://example.eclipse.org/updates/childTwo. You are also able to use absolute URIs as the children repository locations.
<?xml version='1.0' encoding='UTF-8'?> <?compositeMetadataRepository version='1.0.0'?> <repository name='"Eclipse Project Test Site"' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'> <properties size='1'> <property name='p2.timestamp' value='1243822502499'/> </properties> <children size='2'> <child location='childOne'/> <child location='childTwo'/> </children> </repository>
Sample Composite Artifact Repository
<?xml version='1.0' encoding='UTF-8'?> <?compositeArtifactRepository version='1.0.0'?> <repository name='"Eclipse Project Test Site"' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'> <properties size='1'> <property name='p2.timestamp' value='1243822502440'/> </properties> <children size='2'> <child location='childOne'/> <child location='childTwo'/> </children> </repository>
Composite Repositories as part of the build
In order to automate composite repository actions in release engineering builds, we have created Ant tasks which can be called to create and modify repositories. The tasks are defined in the
- failOnExists - Whether we should fail if the repository already exists. (Default is false)
- validate - A comparator-id. Child repositories claiming to contain the same artifact are compared using the given comparator. These are extensions to the org.eclipse.equinox.p2.artifact.repository.artifactComparators extension point. Comparators provided by p2 are:
org.eclipse.equinox.p2.repository.tools.jar.comparator: Compare jars. Class files are dissassembled and compared for equivalence, properties and manifest files are compared as such, all other files are compared byte-for-byte.
org.eclipse.equinox.artifact.md5.comparator: Compare the MD5 sums as recorded in the artifact repositories.
- add - A nested element containing a list of repositories to add to the composite.
- remove - A nested element containing a list repositories to remove from the composite.
Some example Ant tasks for composite repositories and further explanation can be found on the p2 Ant tasks page.