Skip to main content
Jump to: navigation, search

Difference between revisions of "Equinox/p2/Browsable Repository Index"

< Equinox‎ | p2
Line 1: Line 1:
What exactly is inside a particular p2 repository? It's sometimes useful to be able to browse to a repository with your web browser and see what's inside it. Like with [http://net4j.sourceforge.net/update/ this] one.
+
What exactly is inside a particular p2 repository? It's sometimes useful to be able to browse to a repository with your web browser and see what's inside it. Like with [http://net4j.sourceforge.net/update/ this] one, which is created for old-style update sites.
  
 
This page describes a mechanism for adding a readable HTML outline to your repository. Here is an example of a repository with such an outline:
 
This page describes a mechanism for adding a readable HTML outline to your repository. Here is an example of a repository with such an outline:
Line 5: Line 5:
 
[[Image:p2Listing.png]]
 
[[Image:p2Listing.png]]
  
You can provide something similar for your public p2 repository. Just add this Ant [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org.eclipse.emf.cdo/releng/org.eclipse.emf.cdo.releng/build.xml?root=Modeling_Project&view=markup markup] at the end of the site.p2 generation target:
+
You can provide something similar for your public p2 repository. Just add this Ant [http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.releng/build.xml markup] at the end of the site.p2 generation target:
  
 
<source lang="xml">
 
<source lang="xml">
 
<echo message="Creating human readable index.html" />
 
<echo message="Creating human readable index.html" />
 
<unzip src="${site.p2.dir}/content.jar" dest="${site.p2.dir}" />
 
<unzip src="${site.p2.dir}/content.jar" dest="${site.p2.dir}" />
<xslt style="web/P2Content.xsl" in="${site.p2.dir}/content.xml" out="${site.p2.dir}/index.html" />
+
<xslt style="xsl/content2html.xsl" in="${site.p2.dir}/content.xml" out="${site.p2.dir}/index.html" />
 
<delete file="${site.p2.dir}/content.xml" />
 
<delete file="${site.p2.dir}/content.xml" />
 
</source>
 
</source>
  
The [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org.eclipse.emf.cdo/releng/org.eclipse.emf.cdo.releng/web/P2Content.xsl?root=Modeling_Project&view=markup P2Content.xsl] looks like:
+
The [http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.eclipse.emf.cdo.releng/xsl/content2html.xsl content2html.xsl] looks like:
  
 
<source lang="xml">
 
<source lang="xml">

Revision as of 03:46, 6 December 2012

What exactly is inside a particular p2 repository? It's sometimes useful to be able to browse to a repository with your web browser and see what's inside it. Like with this one, which is created for old-style update sites.

This page describes a mechanism for adding a readable HTML outline to your repository. Here is an example of a repository with such an outline:

P2Listing.png

You can provide something similar for your public p2 repository. Just add this Ant markup at the end of the site.p2 generation target:

<echo message="Creating human readable index.html" />
<unzip src="${site.p2.dir}/content.jar" dest="${site.p2.dir}" />
<xslt style="xsl/content2html.xsl" in="${site.p2.dir}/content.xml" out="${site.p2.dir}/index.html" />
<delete file="${site.p2.dir}/content.xml" />

The content2html.xsl looks like:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" omit-xml-declaration="yes" indent="yes"/>
  <xsl:strip-space elements="*"/>
 
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <xsl:apply-templates select="repository"/>
    </html>
  </xsl:template>
 
  <xsl:template match="repository">
    <head>
      <title>
        <xsl:value-of select="@name"/>
      </title>
    </head>
    <body>
      <h1>
        <xsl:value-of select="@name"/>
      </h1>
      <p>
        <em>For information about installing or updating software, see the
          <a
            href="http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-124.htm">
            Eclipse Platform Help</a>.
          <br/> Some plugins require third party drivers from
          <a href="http://net4j.sourceforge.net/update/">Net4j and CDO Plus</a>. </em>
 
      </p>
      <table border="0">
        <tr>
          <td colspan="2">
            <hr/>
            <h2>Features</h2>
          </td>
        </tr>
        <xsl:apply-templates select="//provided[@namespace='org.eclipse.update.feature']">
          <xsl:sort select="@name"/>
        </xsl:apply-templates>
        <tr>
          <td colspan="2">
            <hr/>
            <h2>Plugins</h2>
          </td>
        </tr>
        <xsl:apply-templates select="//provided[@namespace='osgi.bundle']">
          <xsl:sort select="@name"/>
        </xsl:apply-templates>
      </table>
    </body>
  </xsl:template>
 
  <xsl:template match="provided">
    <tr>
      <td>
        <xsl:value-of select="@name"/>
      </td>
      <td>
        <xsl:value-of select="@version"/>
      </td>
    </tr>
  </xsl:template>
 
</xsl:stylesheet>

Original article: What exactly is inside that p2 repository? (by Eike Stepper)

Back to the top