Categories with Composite Repos

>> Thursday, May 21, 2009

Categories are groupings of elements that are available for installation in the p2 user ui. For example, the categories in the Eclipse and Equinox site look something like this...



Ensuring that categories are generated in the content.jar has always been a bit tricky. You can generate a buildtime site.xml that's used to specify the categories which is passed as an argument to the generator. However, this site.xml isn't actually used in the repo because that's old update manager technology. So 2007. You can also add the category name in a p2.inf. Again, not the most intuitive approach.

Today, John Arthorne proposed an interesting solution to this issue in bug 277359 that doesn't require changes to the build scripts. The trick is to add a child metadata repository to your composite repository that only specifies your category IUs. The steps are as follows:

Add a "categories" directory to your composite repository

compositeArtifacts.jar
compositeContent.jar
I20090518-2000/
I20090519-2000/
I20090520-2000/
categories/
In the categories directory, add a content.jar that specifies the IUs of the of the categories you want to display. For the Eclipse project's SDK category, the content.xml looks something like this...

<unit id="org.eclipse.sdk.ide.categoryIU" version="0.0.0">
<properties size="2">
<property name="org.eclipse.equinox.p2.name" value="Eclipse SDK">
<property name="org.eclipse.equinox.p2.type.category" value="true">
</property>
<provides size="1">
<provided namespace="org.eclipse.equinox.p2.iu" name="org.eclipse.sdk.ide.categoryIU" version="0.0.0">
</provided>
<requires size="1">
<required namespace="org.eclipse.equinox.p2.iu" name="org.eclipse.sdk.ide" range="0.0.0">
</required>
<touchpoint id="null" version="0.0.0">
</touchpoint>

The final task is to add the child repo "categories" to your compositeContent.jar in the root of your composite repository. You can use the p2 ant tasks to add the child repo or modify the CompositeContent.xml directly.

<children size="4">
<child location="I20090518-2000">
<child location="I20090519-2000">
<child location="I20090520-2000">
<child location="categories">
</children>

For more information, see bug 277359, the Eclipse and Equinox projects' integration build repo's categories content.jar and compositeContent.jar.

Read more...

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP