Freitag, 3. Juli 2009

Building up an Eclipse team update site mirror

The new Eclipse Galileo (3.5) ships with the completed provisioning system p2. It was introduced with Eclipse Ganymede (3.4) but not every feature was finished at that time.
One of these features is the mirroring-tool.

It enables mirroring of multiple update site in one single site. So it's ideal for companies to construct a single team-mirror with everything they need.

There's a small page which documents, in a rather rudimentary way, how to use it: p2 repository mirroring

You can mirror 2 parts separately: metadata and artifacts.
The metadata tells the eclipse p2 about artifact categories and other information, while the artifacts contains the real plugins.

So to build a full mirror, you need to run both mirroring-applications.

To automate this process I developed a little script that checks a list of update sites and adds artifacts and metadata to your mirror.
A problem was that some mirrors of the mylyn extras had wrong/old metadata, as the downloaded artifacts were 3.2.0 artifacts while the metadata points to 3.1.1 artifacts. So I chose a explicit mirror server (it is commented out, in hope that they have fixed it now).

#Warn for undeclared variables
set -u
#stop on errors
set -e

# choose where to store thing
# Choose a name ot the mirror
dst_name="My Mirror"

# Mylyn Extras
mylyn_extras=( \ \ \
#I used it because of wrong metadata on one of the official mirrors
#mylyn_extras=( \
# \
# \

# M2eclipse for Maven integration
m2eclipse=( \ \

# SpringIDE
spring_ide=( \ \

#Subversive integration and connectors
polarion_svn=( \ \ \

#Test NG integration
testng=( \ \

#Put all the mirrors in a single array
mirror_list=( \
${mylyn_extras[*]} \
${m2eclipse[*]} \
${spring_ide[*]} \
${polarion_svn[*]} \
${testng[*]} \

function mirror(){

./eclipse \
-application org.eclipse.equinox.p2.artifact.repository.mirrorApplication \
-nosplash \
-source $1 \
-destination $dst_repo \
-destinationName $dst_name \
-verbose \

./eclipse \
-application org.eclipse.equinox.p2.metadata.repository.mirrorApplication \
-nosplash \
-source $1 \
-destination $dst_repo \
-destinationName $dst_name \
-verbose \

for aMirror in ${mirror_list[*]}
echo "Mirroring $aMirror (Step $i of ${#mirror_list[*]})"
mirror $aMirror
echo "fin"

Feel free to use it.

Keine Kommentare:

Kommentar veröffentlichen