Thursday, December 4, 2014

Say no to naked p2 repositories!

The standard p2 repository generation tools do not create a landing page for the repository. This creates confusion for novice users who try to visit the published repository in a web browser and get the 404 (not found) error. Beyond novice users, developers and integrators are hampered by inability to easily browse repository content in a web browser.

To save the world from this travesty, I have created a toolkit that can generate a landing page with installation instructions and the content listing pages. These tools are accessible through Ant or directly on the command line.

The landing page contains instructions on how to use Eclipse install software wizard along with a link to browse the repository content.

FireShot Capture - Sapphire 8.1 Repository - http___download.eclipse.org_sapphire_8.1_repository_

The repository content pages show all files and folders along with size information. The listing pages have some interesting features that are worth highlighting.

  1. Size information is listed for folders, not just files
  2. Relative sizes are presented with a sparkline on the right
  3. A summary at the bottom shows the number of folders, the number of files, the total size and the last modified date

FireShot Capture - Folder Content - http___download.eclipse.org_sapphire_8.1_repository_content.html

FireShot Capture - Folder Content_ - http___download.eclipse.org_sapphire-reduced

I have put this to use on all Sapphire releases and builds today. I am also making it available for other projects and companies to use, under EPL terms, of course.

Download (Source)

The toolkit includes two utilities of interest to those wishing to dress up a p2 repository.

GenFolderListing - generates the content listing pages for the specified folder and all child folders

GenRepositoryLanding - generates a repository landing page with installation instructions and the content listing pages

Note that you don’t need to run both tools as GenRepositoryLanding leverages GenFolderListing internally.

Ant Usage

First, import the toolkit...

<import file="sapphire-releng-tools.xml"/>

Alternatively, the jar can be used by itself without the library xml file, but the matching targets will not be available. This may be sufficient if the only requirement is to integrate the tools into the flow of another target.

<taskdef resource="org/eclipse/sapphire/releng/antlib.xml">
    <pathelement location="sapphire-releng-tools.jar"/>

Once the toolkit is imported, use the tools as part of your own target...

<gen-folder-listing folder="${folder}"/>
<gen-repository-landing repository="${repository}" name="${name}"/>

or by calling the provided targets directly...

ant gen-folder-listing -Dfolder=[folder]
ant gen-repository-landing -Drepository=[repository] -Dname=[name]

Command Line Usage

java -cp sapphire-releng-tools.jar org.eclipse.sapphire.releng.listing.GenFolderListingOp [folder]
java -cp sapphire-releng-tools.jar org.eclipse.sapphire.releng.landing.GenRepositoryLandingOp [repository] [name]


SeB said...

That is a great initiative, what would be even better is to make this a Maven plugin and even better to integrate it into the Tycho plugin that build p2 repositories.
Thanks for your work.

Anonymous said...

Thank you for your work. This is great, as you mentioned for novice users. As Seb mentioned, integrating into Tycho is best way to adopt this easily by most as Tycho is getting to be a norm for p2 building.

Konstantin Komissarchik said...

If someone on the Tycho team is reading this... I don't personally use Maven or Tycho in my projects, but I would be willing to contribute this to Tycho, if there is interest. It can also go into p2 itself, if there is interest from that team.

Jan said...

Thanks for your work. I integrated it into our build process. Works perfectly.