0

I am trying to mirror an update site under Windows with the following commands.

eclipsec -nosplash -verbose -application org.eclipse.equinox.p2.artifact.repository.mirrorApplication -writeMode clean -source http://download.eclipse.org/technology/m2e/releases/1.1/1.1.0.20120530-0009 -destination file:/C:/m2ecore
eclipsec -nosplash -verbose -application org.eclipse.equinox.p2.metadata.repository.mirrorApplication -writeMode clean -source http://download.eclipse.org/technology/m2e/releases/1.1/1.1.0.20120530-0009 -destination file:/C:/m2ecore

That works, but it downloads all the artifacts twice, both in canonical form and packed form. For example:

Mirroring: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009 (Descriptor: packed: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009)
Mirroring: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009 (Descriptor: canonical: osgi.bundle,org.eclipse.m2e.editor.source,1.1.0.20120530-0009)

Is there a way to specify that I only want to mirror the canonical forms?
Something like -filter (!format=packed)

I have noticed that there are filters in artifacts.xml and that the p2 application seems to support the filter switch, it's just poorly documented. It looks like an LDAP query but it is not being recognized from the command line.

If it's not possible to filter, how can I safely alter the local repo to remove the packed files from the metadata? Editing the XML by hand doesn't seem like a good idea.


EDIT: Did it the manual way. Leaving the question open in case someone knows how to filter to avoid the unnecessary downloads

Go to C:\m2ecore, unzip artifacts.jar, and then delete it.
Edit the properties section in artifacts.xml

Remove the line <property name='publishPackFilesAsSiblings' value='true'/>
Adjust the properties size parameter (e.g: from 3 to 2)

Edit the mappings section in artifacts.xml

Remove the line <rule filter='(&amp; (classifier=osgi.bundle) (format=packed))' output='${repoUrl}/plugins/${id}_${version}.jar.pack.gz'/>
Remove the line <rule filter='(&amp; (classifier=org.eclipse.update.feature) (format=packed))' output='${repoUrl}/features/${id}_${version}.jar.pack.gz'/>
Adjust the mappings size parameter (e.g.: from 5 to 3)

Remove all packed artifact metadata

Use an editor with regex support to clear all matches of:
<artifact[\s]+[^>]*>(.(?!<[/]?artifact>))+Pack200Unpacker(.(?!<[/]?artifact>))+[\s]*</artifact>

To clear the blank lines, first regex replace with empty strings the matches of:  
^[\s]*$
and then do an extended replace from \r\n\r\n to \r\n

Modify the total artifacts count by searching for matches of:
<artifact[\s]+[^>]*>

Zip artifacts.xml into artifacts.zip and rename it to artifacts.jar
Delete all _*.pack.gz_ files from the tree.

4

1 回答 1

0

独立镜像应用能力有限,你可以使用p2 ant task得到你想要的。

于 2012-08-02T02:26:33.040 回答