Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Equinox/p2/p2 index"

< Equinox‎ | p2
(What is the p2.index file?)
(What is the p2.index file?)
Line 3: Line 3:
 
The p2.index file provides a description of the kind of repository available at a particular location; simple or composite.
 
The p2.index file provides a description of the kind of repository available at a particular location; simple or composite.
  
The presence of this file in a repository will cause p2 to replace its default lookup order for repository to match the one specified in the file. For example the example below will cause p2 to look for content.jar, and then content.xml and if it does not find those, it would fail, rather than look for compositeContent.jar and compositeContent.xml.   
+
The presence of this file in a repository will cause p2 to replace its default lookup order for repository to match the one advised in the file. This only happens the first time a repository is accessed, as p2 then caches "what worked before" and uses that on subsequent accesses. See {{bug|347448}} for more detail, links, and history behind this advisory file. The latest version of the [[Eclipse_b3/aggregator/manual| b3 aggregator]] adds an appropriate p2.index file as it publishes its p2 repository (not sure about other p2 repository publishers).
 +
 
 +
For example the example below will cause p2 to look for content.jar, and then content.xml and if it does not find those, it would fail, rather than look for compositeContent.jar and compositeContent.xml.   
  
 
   version = 1  
 
   version = 1  

Revision as of 11:35, 1 March 2012

What is the p2.index file?

The p2.index file provides a description of the kind of repository available at a particular location; simple or composite.

The presence of this file in a repository will cause p2 to replace its default lookup order for repository to match the one advised in the file. This only happens the first time a repository is accessed, as p2 then caches "what worked before" and uses that on subsequent accesses. See bug 347448 for more detail, links, and history behind this advisory file. The latest version of the b3 aggregator adds an appropriate p2.index file as it publishes its p2 repository (not sure about other p2 repository publishers).

For example the example below will cause p2 to look for content.jar, and then content.xml and if it does not find those, it would fail, rather than look for compositeContent.jar and compositeContent.xml.

 version = 1 
 metadata.repository.factory.order = content.xml,\!
 artifact.repository.factory.order = artifacts.xml,\!

How does it help me?

As a provider of a repository, it does not help you directly, but it helps your users to get a better experience and also slightly reduce the number of hits your server will be subject to.

What happens if I get it wrong ?

Should you get the content of this file wrong, the repository will fail loading. For example specifying compositeContent.xml where the repository is a content.xml will cause p2 to only look for compositeContent.xml and never look at the content.xml.

How many files for composite repositories

Given that a composite repository is just a repository that refers to other repositories, the full benefit of p2.index can only be achieved if every child repo has the file.

Jar vs XML extension

The content of p2.index does not reflect whether the files are zipped or not.

To quote the output of the b3 aggregator:

Please note that the values in this file denotes repository factories and
not files. The factory '<name>.xml' will look for both the <name>.jar
and the <name>.xml file, in that order

For example for a simple repository that contains artifacts.jar and content.jar, the p2.index would still name: "artifacts.xml" and "content.xml".

Example for composite repository

 version = 1
 metadata.repository.factory.order = compositeContent.xml,\!
 artifact.repository.factory.order = compositeArtifacts.xml,\!

Example for simple repository

 version = 1
 metadata.repository.factory.order = content.xml,\!
 artifact.repository.factory.order = artifacts.xml,\!

Copyright © Eclipse Foundation, Inc. All Rights Reserved.