blob: d03c2297cdae5cb53553e9ca7c8fcaeec7842508 [file] [log] [blame]
Stephan Herrmann56942e82010-06-14 19:00:17 +00001#!/bin/sh
2
3BASE=/shared/tools/objectteams
4STAGINGBASE=/opt/public/download-staging.priv/tools/objectteams
5
6# Find the master repository to build upon:
Stephan Herrmanne8a04942010-07-03 07:45:41 +00007if [ "$1" == "none" ]
Stephan Herrmann56942e82010-06-14 19:00:17 +00008then
Stephan Herrmanne8a04942010-07-03 07:45:41 +00009 MASTER="none"
10 echo "Generating fresh new repository"
Stephan Herrmann56942e82010-06-14 19:00:17 +000011else
Stephan Herrmanne8a04942010-07-03 07:45:41 +000012 MASTER=${HOME}/downloads/objectteams/updates/$1
13 if [ -r ${MASTER}/features ]
14 then
15 echo "Generating Repository based on ${MASTER}"
16 else
17 echo "No such repository ${MASTER}"
18 echo "Usage: $0 updateMasterRelativePath [ -nosign ] [ statsRepoId statsVersionId ]"
19 exit 1
20 fi
Stephan Herrmann56942e82010-06-14 19:00:17 +000021fi
22
23# Analyze the version number of the JDT feature as needed for patching content.xml later:
24JDTFEATURE=`ls -d ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_*`
25JDTVERSION=`echo ${JDTFEATURE} | cut -d '_' -f 2`
26JDTVERSIONA=`echo ${JDTVERSION} | cut -d '-' -f 1`
27JDTVERSIONB=`echo ${JDTVERSION} | cut -d '-' -f 2`
28JDTVERSIONB2=`expr $JDTVERSIONB + 1`
29JDTVERSIONB2=`printf "%04d" ${JDTVERSIONB2}`
30echo "JDT feature is ${JDTVERSIONA}-${JDTVERSIONB}"
31if [ ! -r ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_${JDTVERSIONA}-${JDTVERSIONB}-* ]
32then
33 echo "JDT feature not correctly found in ${BASE}/testrun/build-root/eclipse/features"
34 exit 2
35fi
Stephan Herrmann176b44e2010-07-09 22:52:58 +000036OTDTVERSION=`cat ${BASE}/testrun/build-root/src/finalFeaturesVersions.properties|grep "objectteams.otdt="|cut -d '=' -f 2`
37echo "OTDTVERSION is $OTDTVERSION"
Stephan Herrmann56942e82010-06-14 19:00:17 +000038
39# Configure for calling various p2 applications:
40LAUNCHER=`grep equinox.launcher_jar= ${BASE}/build/run.properties | cut -d '=' -f 2`
41LAUNCHER_PATH=${BASE}/testrun/build-root/eclipse/plugins/${LAUNCHER}
42FABPUB=org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
43CATPUB=org.eclipse.equinox.p2.publisher.CategoryPublisher
44NAME="Object Teams"
45
46echo "LAUNCHER_PATH = ${LAUNCHER_PATH}"
47echo "NAME = ${NAME}"
48
49echo "====Step 1: zip and request signing===="
50cd ${BASE}/testrun/updateSite
51JARS=`find . -name \*.jar -type f`
Stephan Herrmann8346e1c2010-06-20 18:07:10 +000052/bin/rm ${STAGINGBASE}/in/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +000053zip ${STAGINGBASE}/in/otdt.zip ${JARS}
54if [ "$2" == "-nosign" ]
55then
56 echo "SKIPING SIGNING"
Stephan Herrmann8bbae122010-06-14 19:12:51 +000057 shift
Stephan Herrmann56942e82010-06-14 19:00:17 +000058else
59 /bin/rm ${STAGINGBASE}/out/otdt.zip
60 sign ${STAGINGBASE}/in/otdt.zip nomail ${STAGINGBASE}/out
61fi
62until [ -r ${STAGINGBASE}/out/otdt.zip ]
63do
64 sleep 10
65 echo -n "."
66done
67echo "Signing completed"
68
69
70echo "====Step 2: fill new repository===="
71if [ -r ${BASE}/stagingRepo ]
72then
73 /bin/rm -rf ${BASE}/stagingRepo
74fi
75mkdir ${BASE}/stagingRepo
76cd ${BASE}/stagingRepo
Stephan Herrmanne8a04942010-07-03 07:45:41 +000077if [ "$MASTER" != "none" ]
78then
79 mkdir features
80 (cd features; ln -s ${MASTER}/features/* .)
81 mkdir plugins
82 (cd plugins; ln -s ${MASTER}/plugins/* .)
83else
84 mkdir plugins
85 cp ${BASE}/testrun/updateSite/plugins/org.apache.bcel* plugins/
86fi
Stephan Herrmann503c4232010-06-27 13:15:05 +000087unzip -n ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +000088
89LOCATION=${BASE}/stagingRepo
90echo "LOCATION = ${LOCATION}"
91cd ${LOCATION}
92
93
94echo "====Step 3: generate metadata===="
95java -jar ${LAUNCHER_PATH} -consoleLog -application ${FABPUB} \
96 -source ${LOCATION} \
97 -metadataRepository file:${LOCATION} \
98 -artifactRepository file:${LOCATION} \
99 -metadataRepositoryName "${NAME} Updates" \
100 -artifactRepositoryName "${NAME} Artifacts"
101ls -ltr *\.*
102
103
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000104echo "====Step 4: patch content for feature inclusion version range===="
105mv content.xml content.xml-orig
106xsltproc -o content.xml --stringparam version ${JDTVERSIONA}-${JDTVERSIONB} \
107 --stringparam versionnext ${JDTVERSIONA}-${JDTVERSIONB2} \
108 ../build/patch-content-xml.xsl content.xml-orig
109ls -ltr *\.*
110
111echo "====Step 5: archive raw meta data===="
112mkdir ../metadata/$OTDTVERSION
113cp *.xml ../metadata/$OTDTVERSION
114ls -ltr ../metadata/$OTDTVERSION/*.xml
115
116echo "====Step 6: generate category===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000117CATEGORYARGS="-categoryDefinition file:${BASE}/testrun/build-root/src/features/org.eclipse.objectteams.otdt/category.xml"
118echo "CATEGORYARGS = ${CATEGORYARGS}"
119java -jar ${LAUNCHER_PATH} -consoleLog -application ${CATPUB} \
120 -source ${LOCATION} \
121 -metadataRepository file:${LOCATION} \
122 ${CATEGORYARGS}
123ls -ltr *\.*
124
125
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000126echo "====Step 7: add download stats capability===="
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000127XSLT_FILE=${BASE}/bin/addDownloadStats.xsl
128
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000129if [ $# == 3 ]; then
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000130 mv artifacts.xml artifacts.xml.original
131 if grep p2.statsURI artifacts.xml.original ; then echo "p2.statsURI already defined: exiting"; exit 1; fi
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000132 xsltproc -o artifacts.xml --stringparam repo "http://download.eclipse.org/stats/objectteams/${2}" --stringparam version $3 $XSLT_FILE artifacts.xml.original
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000133fi
Stephan Herrmann56942e82010-06-14 19:00:17 +0000134
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000135echo "====Step 8: jar-up metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000136jar cf content.jar content.xml
137jar cf artifacts.jar artifacts.xml
Stephan Herrmann503c4232010-06-27 13:15:05 +0000138/bin/rm *.xml*
Stephan Herrmann56942e82010-06-14 19:00:17 +0000139ls -ltr *\.*
140
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000141echo "====Step 9: cleanup: remove symbolic links===="
Stephan Herrmann503c4232010-06-27 13:15:05 +0000142find . -type l -exec /bin/rm {} \;
143
Stephan Herrmann56942e82010-06-14 19:00:17 +0000144echo "====DONE===="