Skip to content
This repository has been archived by the owner on Oct 20, 2018. It is now read-only.

Composite Repository Build

hmalphettes edited this page Jun 16, 2011 · 4 revisions

Composite Repositories

p2 composite repositories are a pair of small XML files that link to a list of other repositories. They are similar to an html page that list a set of hyperlinks. The links must either be relative to the current location either be complete URLs.

Composite repositories are generated by the tycho-p2-scripts in an easy manner by navigating the filesystem and using glob expressions. tycho-p2-scripts also generate an html page to describe the composite repository.

Version-ed and ‘latest’ composite repository.

tycho-p2-scripts deploys version-ed repositories:

${HTTPD_ROOT_PATH}/{$groupId_path}/${BRANCH}/${completeVersion}

For development, it is very useful to maintain a composite repository that always points to the latest build of the children repositories. This without having to make a new release of the composite repository. We call this repository the ‘latest’.

Each child repository built by tycho-p2-scripts on a branch maintains a symbolic link to the most recent build on a branch. For example:

${HTTPD_ROOT_PATH}/{$child_groupId_path}/${BRANCH}/1.0.0.099
${HTTPD_ROOT_PATH}/{$child_groupId_path}/${BRANCH}/current

Where ‘1.0.0.099’ is the most recent build, then current is a symbolic link that targets 1.0.0.099.

Output of the project

A single composite repository is managed by each project. tycho-p2-scripts generate 2 composite repositories: the version-ed one and the ‘latest’ one. They are deployed on the file system on the following path:

${HTTPD_ROOT_PATH}/{$groupId_path}/${BRANCH}/${completeVersion}
${HTTPD_ROOT_PATH}/{$groupId_path}/${BRANCH}/latest

It also maintains the symbolic link ‘current’ that points to the latest version-ed build:

${HTTPD_ROOT_PATH}/{$groupId_path}/${BRANCH}/current

Project layout

tycho-p2-scripts requires 2 files to be present at the root of the project:

  • Buildfile: defines the groupId and the version and build number.

  • children.repos: defines the selectors of the children repositories.

Buildfile

It defines the completeVersion and groupId. At the minimum, it must define a project with a version and a groupId:

VERSION_NUMBER="1.0.0.001-SNAPSHOT"
define "intalio-mycompositerepo" do
  project.version = VERSION_NUMBER
  project.group = "org.intalio.cloud.mycompositerepo"
  #Insert custom build here
end

It is important to pad the build number with ‘0s’. 3 digits long is recommended.

The completeVersion is extracted from the VERSION_NUMBER when ‘-SNAPSHOT’ is removed. For example here:

completeVersion=1.0.0.001

At the end of the build, the build number is incremented and the Buildfile is updated and committed in the source control.

Although the syntax follows the apache-buildr syntax, note that tycho-p2-script does not invoke buildr. If buildr is present it is possible to define some tasks to execute. tycho-p2-scripts will invoke them and give you the opportunity to do more than just generate the composite repository.

children.repos file

Each line of the ‘repos’ file can be:

  • A comment if it starts with ‘#’

  • An absolute URL to another repository if it contains ‘://’

  • An absolute path on the filesystem if it starts with ‘/’

  • The definition of a base directory if it starts with BASE=

  • A path relative to the current BASE to a p2 repository.

  • Both the absolute and relative path support a glob expression for the last segment of the path.

  • Each line if it contains shell variables will have those variables expanded.

Sample children.repos:

#add an external repo to the children:
http://www.intalio.org/public/p2repo/org/jruby/
#add a set of repos relative to the home directory
BASE=$HOME/p2repo/org
eclipse/eclipse/updates/3.6
eclipse/jetty/updates/3.7milestones/S-3.7.RC3-201106010634
#BASE: all relative paths will be relative to the BASE
BASE=$HOME/p2repo/com/intalio/cloud
#select the child repositories: select the versionned repositories
#then choose the latest ones amongst each selected repository.
cas/master/*
platform/performance/1.0.0.004
bpm/master/2.0.0.*