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
dst_repo="file:/D:/update_35"
# Choose a name ot the mirror
dst_name="My Mirror"


# Mylyn Extras
mylyn_extras=( \
http://download.eclipse.org/tools/mylyn/update/extras \
http://download.eclipse.org/tools/mylyn/update/incubator \
)
#I used it because of wrong metadata on one of the official mirrors
#mylyn_extras=( \
# ftp://mirror.netcologne.de/eclipse//tools/mylyn/update/extras/ \
# ftp://mirror.netcologne.de/eclipse//tools/mylyn/update/incubator/ \
#)

# M2eclipse for Maven integration
m2eclipse=( \
http://m2eclipse.sonatype.org/update-dev/ \
)

# SpringIDE
spring_ide=( \
http://springide.org/updatesite/ \
)

#Subversive integration and connectors
polarion_svn=( \
http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/ \
http://community.polarion.com/projects/subversive/download/integrations/update-site/ \
)

#Test NG integration
testng=( \
http://beust.com/eclipse/ \
)

#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 \
-compare


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

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


Feel free to use it.

Keine Kommentare:

Kommentar veröffentlichen