The new format is available in builds after April 26, 2009 (Eclipse 3.5M7+).

−

===Create Composite Repository===

+

This wiki may be out of date. See also:

−

The create composite repository tasks can be used to create an artifact or a metadata composite repository. An existing repository can be used as an example and the new repository will match the properties of the example.

The p2.mirror task is used to copy the contents of one repository to another. The location of the destination repository must be modifiable, and if a destination repository of a type is defined then a source for that type must also be present

+

+

+

''Note that in the examples in this section the tasks contain a &lt;/source&gt; tag. This tag should not contain a space - it is present due to a limitation in the wiki software.''

+

+

+

<br>

+

+

+

=== Simple Examples ===

+

+

A task to mirror only the contents of a metadata repository at a given location:

The source repositories can also be defined through a FileSet (see Apache Ant documentation for defining a fileset), though if the location(s) in the filesetshould be a specific kind of repository that should also be specified by again using the kind attribute:

+

+

+

<source lang="xml">

+

<p2.mirror>

+

<repository location="file:/myDestination" name="A new repository" />

+

<source>

+

<repository location="http://aSource/" />

+

<fileset kind="m" .... />

+

< /source>

+

<iu id="tooling.osgi.bundle.default" version="1.0.0" />

+

<slicingoptions platformfilter="win32,win32,x86" />

+

</p2.mirror>

+

</source>

+

+

+

<br>

+

+

+

=== Repository Format ===

+

+

By default if the destination repositories already exist then the new data is appended, this can be prevented by adding the append attribute with the value false:

To create a new repository using the properties of an existing repository the format attribute is added to the repository element. This can be used to prevent storing pack200'd artifacts in the .blobstore, preserving them as siblings (if they were siblings in the stated site from which to pull the format).

Its also possible to partially mirror a repository, the simplest method is to specify an individual IU which will result in the default slicing options being used. If an artifact destination repository is defined then the artifacts required by the IUs will also be mirrored.

+

+

<source lang="xml">

+

<p2.mirror>

+

<repository location="file:/myDestination" name="A new repository" />

+

<source>

+

<repository location="http://aSource/" />

+

< /source>

+

<iu id="tooling.osgi.bundle.default" version="1.0.0" />

+

</p2.mirror>

+

</source>

+

+

If only windows IUs and artifacts were required then a slicingOptions element needs to be defined with a platform filter:

+

+

<source lang="xml">

+

<p2.mirror>

+

<repository location="file:/myDestination" name="A new repository" />

+

<source>

+

<repository location="http://aSource/" />

+

< /source>

+

<iu id="tooling.osgi.bundle.default" version="1.0.0" />

+

<slicingoptions platformfilter="win32,win32,x86" />

+

</p2.mirror>

+

</source>

+

+

For a working example of partial mirroring, see [[Equinox/p2/Ant Tasks/Partial Mirroring/Example]].

+

+

=== Comparison ===

+

+

There are several comparators (eg. MD5, JarComparator) available which can be used to compare the contents of a repository, when these are used the artifact must either be present in the destination repository, or a baseline repository must be defined.

Ant task which calls the "repo to runnable" application. This application takes an existing p2 repository (local or remote), iterates over its list of IUs, and fetches all of the corresponding artifacts to a user-specified location. Once fetched, the artifacts will be in "runnable" form... that is directory-based bundles will be extracted into folders and packed JAR files will be un-packed.

* local '''archived''' p2 repo or update site (zip) - '''''remote archived site not supported'''''

+

* absolute (jar:file:, file:, http:) or relative paths

+

* sites and zips containing pack200'd jars

+

+

See also [https://bugs.eclipse.org/bugs/show_bug.cgi?id=277504#c16 bug 277504].

+

+

==Common Task Elements==

+

===Repositories===

The input format used by repositories in p2 Ant tasks:

The input format used by repositories in p2 Ant tasks:

<source lang=xml>

<source lang=xml>

Line 61:

Line 350:

| URI

| URI

| null

| null

−

| Location of a repository to copy format from

+

| Location of a repository to copy format from. This can be used to prevent storing pack200'd artifacts in the .blobstore, preserving them as siblings (if they were siblings in the stated site from which to pull the format).

The create composite repository tasks can be used to create an artifact or a metadata composite repository. An existing repository can be used as an example and the new repository will match the properties of the example.

+

! Attribute

+

! Type

+

! Default

+

! Description

+

|-

+

| filter

+

| comma separated list

+

| none

+

| A comma separated list of filter options for the slicer

+

|-

+

| followOnlyFilteredRequirements

+

| boolean

+

| false

+

|

+

|-

+

| followStrict

+

| boolean

+

| false

+

| This influences (among other things?) if the dependencies of features are part of the mirror operation. A value of true will exclude these dependencies. With dependencies the plug-ins and features are meant that are referenced in the "requires" element of a feature.xml.

+

|-

+

| includeFeatures

+

| boolean

+

| true

+

| Include features (org.eclipse.update.install.features)

+

|-

+

| includeNonGreedy

+

| boolean

+

| true

+

|

+

|-

+

| includeOptional

+

| boolean

+

| true

+

|

+

|-

+

| platformFilter

+

| os,ws,arch

+

| none

+

| Filter based on the platform

+

|-

+

| latestVersionOnly

+

| boolean

+

| false

+

| Set to "true" to filter the resulting set of IUs to only included the latest version of each Installable Unit. By default, all versions satisfying dependencies are included.

Mirror Task

The p2.mirror task is used to copy the contents of one repository to another. The location of the destination repository must be modifiable, and if a destination repository of a type is defined then a source for that type must also be present

Note that in the examples in this section the tasks contain a </source> tag. This tag should not contain a space - it is present due to a limitation in the wiki software.

Simple Examples

A task to mirror only the contents of a metadata repository at a given location:

The repositories in the tasks can be a mixture specified kinds and co-located.

Multiple Repositories

The source or destination metadata and artifact repositories need not be co-located, although the tasks are limited to at most one artifact and one metadata destination repository.

<p2.mirror><repositorylocation="file:/myArtifactDestination"name="A new repository"kind="A"/><repositorylocation="file:/myMetaDestination"name="A new repository"kind="M"/><source><repositorylocation="http://aSource/"/>< /source></p2.mirror>

Multiple source locations can also be defined:

<p2.mirror><repositorylocation="file:/myArtifactDestination"name="A new repository"kind="A"/><repositorylocation="file:/myMetaDestination"name="A new repository"kind="M"/><source><repositorylocation="http://aSource2/"/><repositorylocation="http://aSourceMeta/"kind="M"/><repositorylocation="http://aSourceArtifact/"kind="A"/>< /source></p2.mirror>

Fileset Repositories

The source repositories can also be defined through a FileSet (see Apache Ant documentation for defining a fileset), though if the location(s) in the filesetshould be a specific kind of repository that should also be specified by again using the kind attribute:

Repository Format

By default if the destination repositories already exist then the new data is appended, this can be prevented by adding the append attribute with the value false:

<p2.mirror><repositorylocation="file:/myArtifactDestination"name="A new repository"kind="A"append="false"/><repositorylocation="file:/myMetaDestination"name="A new repository"kind="M"append="false"/><source><repositorylocation="http://aSource/"/>< /source></p2.mirror>

To create a new repository using the properties of an existing repository the format attribute is added to the repository element. This can be used to prevent storing pack200'd artifacts in the .blobstore, preserving them as siblings (if they were siblings in the stated site from which to pull the format).

<p2.mirror><repositorylocation="file:/myArtifactDestination"name="A new repository"kind="A"format="http://somerepo/"/><repositorylocation="file:/myMetaDestination"name="A new repository"kind="M"append="false"/><source><repositorylocation="http://aSource/"/>< /source></p2.mirror>

Partial Mirroring

Its also possible to partially mirror a repository, the simplest method is to specify an individual IU which will result in the default slicing options being used. If an artifact destination repository is defined then the artifacts required by the IUs will also be mirrored.

Comparison

There are several comparators (eg. MD5, JarComparator) available which can be used to compare the contents of a repository, when these are used the artifact must either be present in the destination repository, or a baseline repository must be defined.

Composite Repository Task

The p2.composite.repository task can be used to create or to modify the child repos of a composite repository

Create

To create a composite repository and add a single child:

<p2.composite.repository><repositorylocation="file:/myDestination"name="A new repository"kind="M"/><add><repositorylocation="http://aSource/"kind="M"/></add></p2.composite.repository>

The task can be told to fail if a repository already exists at the location to prevent accidental modification by adding the failOnExists attribute

<p2.composite.repositoryfailOnExists="true"><repositorylocation="file:/myDestination"name="A new repository"kind="M"/><add><repositorylocation="http://aSource/"kind="M"/></add></p2.composite.repository>

As with the mirror task it is possible to specify a mixture of repositories, in this particular example a co-located repository will be created with the appropriate children added:

<p2.composite.repositoryfailOnExists="true"><repositorylocation="file:/myDestination"name="A new repository"/><add><repositorylocation="http://aSource/"kind="M"/><repositorylocation="http://aSource2/"kind="A"/></add></p2.composite.repository>

Modify

The syntax to add a child to an existing repository is the same as creating a new one:

<p2.composite.repository><repositorylocation="file:/myDestination"name="A new repository"/><add><repositorylocation="http://aSource/"kind="M"/><repositorylocation="http://aSource2/"kind="A"/></add></p2.composite.repository>

Children can also be removed from a composite repository:

<p2.composite.repository><repositorylocation="file:/myDestination"name="A new repository"/><remove><repositorylocation="http://aSource/"kind="M"/><repositorylocation="http://aSource2/"kind="A"/></remove></p2.composite.repository>

Pre-existing children can be removed from the repository prior to adding new children by using the append attribute:

<p2.composite.repository><repositorylocation="file:/myDestination"name="A new repository"append="false"/><add><repositorylocation="http://aSource/"kind="M"/><repositorylocation="http://aSource2/"kind="A"/></add></p2.composite.repository>

Validate

To ensure that the composite repository has consistent contents an artifact comparator can be used

<p2.composite.repositoryvalidate="org.eclipse.equinox.artifact.md5.comparator"><repositorylocation="file:/myDestination"name="A new repository"append="false"/><add><repositorylocation="http://aSource/"kind="M"/><repositorylocation="http://aSource2/"kind="A"/></add></p2.composite.repository>

Repo2Runnable

Ant task which calls the "repo to runnable" application. This application takes an existing p2 repository (local or remote), iterates over its list of IUs, and fetches all of the corresponding artifacts to a user-specified location. Once fetched, the artifacts will be in "runnable" form... that is directory-based bundles will be extracted into folders and packed JAR files will be un-packed.

In general the location is always required, other attributes may not be used by individual tasks.

Attribute

Type

Default

Description

location

URI

null

The location of the repository

append

boolean

true

Determines if the task should append to an existing repository or empty it first

compressed

boolean

true

Determines if the repository should be compressed

format

URI

null

Location of a repository to copy format from. This can be used to prevent storing pack200'd artifacts in the .blobstore, preserving them as siblings (if they were siblings in the stated site from which to pull the format).

kind

"metadata" or "artifact"

Both

Specifies the type of the repository. Default is to add both a metadata and artifact repository

This influences (among other things?) if the dependencies of features are part of the mirror operation. A value of true will exclude these dependencies. With dependencies the plug-ins and features are meant that are referenced in the "requires" element of a feature.xml.

includeFeatures

boolean

true

Include features (org.eclipse.update.install.features)

includeNonGreedy

boolean

true

includeOptional

boolean

true

platformFilter

os,ws,arch

none

Filter based on the platform

latestVersionOnly

boolean

false

Set to "true" to filter the resulting set of IUs to only included the latest version of each Installable Unit. By default, all versions satisfying dependencies are included.