Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Equinox/p2/p2.mirrorsURL"
(moved here from IT Infrastructure Doc) |
(Added reference to bug where ftp support is tracked.) |
||
Line 22: | Line 22: | ||
* replace <code>{repository_path}</code> with the path where your artifacts.jar sits on <code>download.eclipse.org</code>,<br/>e.g., for http://download.eclipse.org/eclipse/updates/3.6/R-3.6.2-201102101200/artifacts.jar the path would be <code>/eclipse/updates/3.6/R-3.6.2-201102101200</code> | * replace <code>{repository_path}</code> with the path where your artifacts.jar sits on <code>download.eclipse.org</code>,<br/>e.g., for http://download.eclipse.org/eclipse/updates/3.6/R-3.6.2-201102101200/artifacts.jar the path would be <code>/eclipse/updates/3.6/R-3.6.2-201102101200</code> | ||
* yes, <code>&amp;</code> is 5 characters | * yes, <code>&amp;</code> is 5 characters | ||
− | * the last part, <code>&amp;protocol=http</code> is important, since it restricts the list of mirrors to those that support http | + | * the last part, <code>&amp;protocol=http</code> is important, since it restricts the list of mirrors to those that support http. Monitor {{bug|349679}} for status/progress on p2 working with ftp sites. (In general, such as for zip files linked on download pages, and similar, the 'protocol' parameter is optional for the <code>download.php</code> script and when omitted both http and ftp mirrors are returned). |
− | This will tell p2 to use the given URL | + | |
+ | This <code>p2.mirrorsURL</code> property will tell p2 to use the given URL to fetch a list of available mirrors (in xml format). | ||
===How to add?=== | ===How to add?=== |
Revision as of 16:00, 19 June 2011
Disclaimer: this page is not authored by a p2 expert, I merely reproduced some information which I found difficult to collect -- Stephan
Contents
Enabling your repository to leverage mirrors
The p2.mirrorsURL
should be added to your metadata so that p2 will see the list
of available mirrors to choose during installation.
Where to add?
Adding this property to artifacts.xml
is sufficient, since p2 uses a list of mirrors while retrieving artifacts, not the metadata itself. Obviously, artifacts.jar
must be updated or replaced after changing artifact.xml.
Should composite repos be treated, too, or just their children (leaves)?
Just the leaves. No need to to specify the property in compositeArtifacts.xml/jar.
What to add?
The property has the following structure:
<property name="p2.mirrorsURL" value="http://www.eclipse.org/downloads/download.php?file={repository_path}&format=xml&protocol=http"/>
- replace
{repository_path}
with the path where your artifacts.jar sits ondownload.eclipse.org
,
e.g., for http://download.eclipse.org/eclipse/updates/3.6/R-3.6.2-201102101200/artifacts.jar the path would be/eclipse/updates/3.6/R-3.6.2-201102101200
- yes,
&
is 5 characters - the last part,
&protocol=http
is important, since it restricts the list of mirrors to those that support http. Monitor bug 349679 for status/progress on p2 working with ftp sites. (In general, such as for zip files linked on download pages, and similar, the 'protocol' parameter is optional for thedownload.php
script and when omitted both http and ftp mirrors are returned).
This p2.mirrorsURL
property will tell p2 to use the given URL to fetch a list of available mirrors (in xml format).
How to add?
If you use a site.xml
the word goes that this is where you should specify this property. The Equinox/p2/Publisher should automatically
transfer this information into your metadata.
If you don't use a site.xml
you may consider manually editing artifacts.xml
(which of course can be automated using, e.g.,
an xsl template, like this p2.xsl from the Mylyn project). When manually editing artifacts.xml
add the property to the existing list of properties right at the top of the document. Don't forget to update the size
attribute of the enclosing <properties>
element.
How to test?
First, you may paste the full URL you specified as the value into your browser (now collapse & to &). The result should be an XML file with lots of mirror URLs. Pasting one of these URLs into the browser should in turn take you to the directory holding your artifacts.jar
and friends.
Secondly, to test whether install successfully uses mirrors you may use the following options file (stored, e.g., as /tmp/p2options
):
org.eclipse.equinox.p2.core/debug=true org.eclipse.equinox.p2.core/artifacts/mirrors=true
(The first line generally enables debugging p2, the second line selects specific tracing for mirror selection)
Then you may want to unpack a fresh Eclipse package and change into the eclipse
directory.
Finally, use the Equinox/p2/Director application for installing your feature using this command line:
./eclipse -consoleLog -noSplash -debug /tmp/p2options -application org.eclipse.equinox.p2.director \ -repository http://download.eclipse.org/myproject/myrepo \ -installIU org.eclipse.myproject.myfeature.group
This should install your feature and print to the console where each artifact was downloaded from.
If p2.mirrorsURL
is not properly configured no such messages will be shown.
Conversely, you can disable the automatic mirror selection mechanism by setting the VM argument eclipse.p2.mirrors to false (remember that vm args have to be last on the command line preceded by the switch -vmargs
).
Moving a repo to archive.eclipse.org
Another situation where redirected downloads are desirable is when a repo is moved from download.eclipse.org to archive.eclipse.org. For files references using the Find a Mirror script (http://www.eclipse.org/downloads/download.php?file=/path/to/a/file.zip) moving to archive is transparently handled by that script. This section is exploring how the same effect can be achieved for p2 repositories.
The obvious way might be through the use of p2.mirrorsURL, however, I couldn't get this to work -- Stephan.
The following strategy seems to do the job (although admittedly, not a candidate for beauty contests):
- when moving everything to archive.eclipse.org keep a copy of all metadata (
artifacts.jar
and all those) on download.eclipse.org. - extract the .xml files and edit like so:
- for composite repositories
- edit both compositeContent.xml and compositeArtifacts.xml:
- simply change all relative paths to absolute paths pointing to http://archive.eclipse.org/something
- for leaf repositories
- edit artifacts.xml (this is the ugly, unofficial approach - use at your own risk):
- remove any
p2.mirrorsURL
property (and decrease thesize
of the enclosing<properties>
element accordingly). - in the
<mappings>
element replace all occurrences of${repoUrl}
with the archive path to your repo, likehttp://archive.eclipse.org/objectteams/updates/ot0.7
- to be on the safe side increment the p2.timestamp value in the top list of properties
- remove any
After editing put the .xml files back into their respective jar.