blob: 763c7db9ce994b79ed1f5af77d9552533cc9f173 [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_*`
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000025if echo $JDTFEATURE | grep "\.r"
26then
27 JDTVERSION="`echo ${JDTFEATURE} | cut -d '_' -f 2`_`echo ${JDTFEATURE} | cut -d '_' -f 3`"
28else
29 JDTVERSION=`echo ${JDTFEATURE} | cut -d '_' -f 2`
30fi
Stephan Herrmann56942e82010-06-14 19:00:17 +000031JDTVERSIONA=`echo ${JDTVERSION} | cut -d '-' -f 1`
32JDTVERSIONB=`echo ${JDTVERSION} | cut -d '-' -f 2`
33JDTVERSIONB2=`expr $JDTVERSIONB + 1`
34JDTVERSIONB2=`printf "%04d" ${JDTVERSIONB2}`
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000035JDTVERSION=${JDTVERSIONA}-${JDTVERSIONB}
36JDTVERSIONNEXT=${JDTVERSIONA}-${JDTVERSIONB2}
37#JDTVERSION=${JDTVERSIONA}
38#JDTVERSIONNEXT=3.7.0.v20110122
39echo "JDT feature is ${JDTVERSION}"
40if [ ! -r ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_${JDTVERSION}-* ]
Stephan Herrmann56942e82010-06-14 19:00:17 +000041then
42 echo "JDT feature not correctly found in ${BASE}/testrun/build-root/eclipse/features"
43 exit 2
44fi
Stephan Herrmann176b44e2010-07-09 22:52:58 +000045OTDTVERSION=`cat ${BASE}/testrun/build-root/src/finalFeaturesVersions.properties|grep "objectteams.otdt="|cut -d '=' -f 2`
46echo "OTDTVERSION is $OTDTVERSION"
Stephan Herrmann56942e82010-06-14 19:00:17 +000047
48# Configure for calling various p2 applications:
49LAUNCHER=`grep equinox.launcher_jar= ${BASE}/build/run.properties | cut -d '=' -f 2`
50LAUNCHER_PATH=${BASE}/testrun/build-root/eclipse/plugins/${LAUNCHER}
51FABPUB=org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
52CATPUB=org.eclipse.equinox.p2.publisher.CategoryPublisher
Stephan Herrmann438548f2010-08-21 23:15:22 +000053JARPROCESSOR=`ls ${BASE}/testrun/build-root/eclipse/plugins/org.eclipse.equinox.p2.jarprocessor_*.jar`
Stephan Herrmann56942e82010-06-14 19:00:17 +000054NAME="Object Teams"
55
56echo "LAUNCHER_PATH = ${LAUNCHER_PATH}"
57echo "NAME = ${NAME}"
58
59echo "====Step 1: zip and request signing===="
60cd ${BASE}/testrun/updateSite
61JARS=`find . -name \*.jar -type f`
Stephan Herrmann8346e1c2010-06-20 18:07:10 +000062/bin/rm ${STAGINGBASE}/in/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +000063zip ${STAGINGBASE}/in/otdt.zip ${JARS}
64if [ "$2" == "-nosign" ]
65then
66 echo "SKIPING SIGNING"
Stephan Herrmanncb88cf12010-07-22 21:24:10 +000067 /bin/mv ${STAGINGBASE}/in/otdt.zip ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann8bbae122010-06-14 19:12:51 +000068 shift
Stephan Herrmann56942e82010-06-14 19:00:17 +000069else
70 /bin/rm ${STAGINGBASE}/out/otdt.zip
71 sign ${STAGINGBASE}/in/otdt.zip nomail ${STAGINGBASE}/out
72fi
73until [ -r ${STAGINGBASE}/out/otdt.zip ]
74do
75 sleep 10
76 echo -n "."
77done
78echo "Signing completed"
79
80
81echo "====Step 2: fill new repository===="
82if [ -r ${BASE}/stagingRepo ]
83then
84 /bin/rm -rf ${BASE}/stagingRepo
85fi
86mkdir ${BASE}/stagingRepo
87cd ${BASE}/stagingRepo
Stephan Herrmanne8a04942010-07-03 07:45:41 +000088if [ "$MASTER" != "none" ]
89then
90 mkdir features
91 (cd features; ln -s ${MASTER}/features/* .)
92 mkdir plugins
93 (cd plugins; ln -s ${MASTER}/plugins/* .)
94else
95 mkdir plugins
96 cp ${BASE}/testrun/updateSite/plugins/org.apache.bcel* plugins/
97fi
Stephan Herrmann503c4232010-06-27 13:15:05 +000098unzip -n ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +000099
100LOCATION=${BASE}/stagingRepo
101echo "LOCATION = ${LOCATION}"
102cd ${LOCATION}
103
Stephan Herrmann438548f2010-08-21 23:15:22 +0000104echo "====Step 3: pack jars ===="
105for dir in ${LOCATION}/features ${LOCATION}/plugins
106do
107 find ${dir} -type f -name \*.jar -exec \
Stephan Herrmanna53f6d32011-03-30 01:14:24 +0000108 ${JAVA5}/bin/java -jar ${JARPROCESSOR} -verbose -pack -outputDir ${dir} {} \;
Stephan Herrmann438548f2010-08-21 23:15:22 +0000109done
Stephan Herrmann56942e82010-06-14 19:00:17 +0000110
Stephan Herrmann438548f2010-08-21 23:15:22 +0000111
112echo "====Step 4: generate metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000113java -jar ${LAUNCHER_PATH} -consoleLog -application ${FABPUB} \
114 -source ${LOCATION} \
115 -metadataRepository file:${LOCATION} \
116 -artifactRepository file:${LOCATION} \
117 -metadataRepositoryName "${NAME} Updates" \
Stephan Herrmann438548f2010-08-21 23:15:22 +0000118 -artifactRepositoryName "${NAME} Artifacts" \
119 -reusePack200Files -publishArtifacts
Stephan Herrmann56942e82010-06-14 19:00:17 +0000120ls -ltr *\.*
121
122
Stephan Herrmann438548f2010-08-21 23:15:22 +0000123echo "====Step 5: patch content for feature inclusion version range===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000124mv content.xml content.xml-orig
Stephan Herrmanna53f6d32011-03-30 01:14:24 +0000125xsltproc -o content.xml --stringparam version ${JDTVERSION} \
126 --stringparam versionnext ${JDTVERSIONNEXT} \
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000127 ../build/patch-content-xml.xsl content.xml-orig
128ls -ltr *\.*
129
Stephan Herrmann438548f2010-08-21 23:15:22 +0000130echo "====Step 6: archive raw meta data===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000131mkdir ../metadata/$OTDTVERSION
132cp *.xml ../metadata/$OTDTVERSION
133ls -ltr ../metadata/$OTDTVERSION/*.xml
134
Stephan Herrmann438548f2010-08-21 23:15:22 +0000135echo "====Step 7: generate category===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000136CATEGORYARGS="-categoryDefinition file:${BASE}/testrun/build-root/src/features/org.eclipse.objectteams.otdt/category.xml"
137echo "CATEGORYARGS = ${CATEGORYARGS}"
138java -jar ${LAUNCHER_PATH} -consoleLog -application ${CATPUB} \
139 -source ${LOCATION} \
140 -metadataRepository file:${LOCATION} \
141 ${CATEGORYARGS}
142ls -ltr *\.*
143
144
Stephan Herrmann438548f2010-08-21 23:15:22 +0000145echo "====Step 8: add download stats capability===="
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000146XSLT_FILE=${BASE}/bin/addDownloadStats.xsl
147
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000148if [ $# == 3 ]; then
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000149 mv artifacts.xml artifacts.xml.original
150 if grep p2.statsURI artifacts.xml.original ; then echo "p2.statsURI already defined: exiting"; exit 1; fi
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000151 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 +0000152fi
Stephan Herrmann56942e82010-06-14 19:00:17 +0000153
Stephan Herrmann438548f2010-08-21 23:15:22 +0000154echo "====Step 9: jar-up metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000155jar cf content.jar content.xml
156jar cf artifacts.jar artifacts.xml
Stephan Herrmann503c4232010-06-27 13:15:05 +0000157/bin/rm *.xml*
Stephan Herrmann56942e82010-06-14 19:00:17 +0000158ls -ltr *\.*
159
Stephan Herrmann438548f2010-08-21 23:15:22 +0000160echo "====Step 10: cleanup: remove symbolic links===="
Stephan Herrmann503c4232010-06-27 13:15:05 +0000161find . -type l -exec /bin/rm {} \;
162
Stephan Herrmann56942e82010-06-14 19:00:17 +0000163echo "====DONE===="