blob: f9478c06c12ad5c7ee9f1c4a513fcedff30c3ba1 [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
Stephan Herrmann438548f2010-08-21 23:15:22 +000044JARPROCESSOR=`ls ${BASE}/testrun/build-root/eclipse/plugins/org.eclipse.equinox.p2.jarprocessor_*.jar`
Stephan Herrmann56942e82010-06-14 19:00:17 +000045NAME="Object Teams"
46
47echo "LAUNCHER_PATH = ${LAUNCHER_PATH}"
48echo "NAME = ${NAME}"
49
50echo "====Step 1: zip and request signing===="
51cd ${BASE}/testrun/updateSite
52JARS=`find . -name \*.jar -type f`
Stephan Herrmann8346e1c2010-06-20 18:07:10 +000053/bin/rm ${STAGINGBASE}/in/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +000054zip ${STAGINGBASE}/in/otdt.zip ${JARS}
55if [ "$2" == "-nosign" ]
56then
57 echo "SKIPING SIGNING"
Stephan Herrmanncb88cf12010-07-22 21:24:10 +000058 /bin/mv ${STAGINGBASE}/in/otdt.zip ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann8bbae122010-06-14 19:12:51 +000059 shift
Stephan Herrmann56942e82010-06-14 19:00:17 +000060else
61 /bin/rm ${STAGINGBASE}/out/otdt.zip
62 sign ${STAGINGBASE}/in/otdt.zip nomail ${STAGINGBASE}/out
63fi
64until [ -r ${STAGINGBASE}/out/otdt.zip ]
65do
66 sleep 10
67 echo -n "."
68done
69echo "Signing completed"
70
71
72echo "====Step 2: fill new repository===="
73if [ -r ${BASE}/stagingRepo ]
74then
75 /bin/rm -rf ${BASE}/stagingRepo
76fi
77mkdir ${BASE}/stagingRepo
78cd ${BASE}/stagingRepo
Stephan Herrmanne8a04942010-07-03 07:45:41 +000079if [ "$MASTER" != "none" ]
80then
81 mkdir features
82 (cd features; ln -s ${MASTER}/features/* .)
83 mkdir plugins
84 (cd plugins; ln -s ${MASTER}/plugins/* .)
85else
86 mkdir plugins
87 cp ${BASE}/testrun/updateSite/plugins/org.apache.bcel* plugins/
88fi
Stephan Herrmann503c4232010-06-27 13:15:05 +000089unzip -n ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +000090
91LOCATION=${BASE}/stagingRepo
92echo "LOCATION = ${LOCATION}"
93cd ${LOCATION}
94
Stephan Herrmann438548f2010-08-21 23:15:22 +000095echo "====Step 3: pack jars ===="
96for dir in ${LOCATION}/features ${LOCATION}/plugins
97do
98 find ${dir} -type f -name \*.jar -exec \
99 java -jar ${JARPROCESSOR} -verbose -pack -outputDir ${dir} {} \;
100done
Stephan Herrmann56942e82010-06-14 19:00:17 +0000101
Stephan Herrmann438548f2010-08-21 23:15:22 +0000102
103echo "====Step 4: generate metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000104java -jar ${LAUNCHER_PATH} -consoleLog -application ${FABPUB} \
105 -source ${LOCATION} \
106 -metadataRepository file:${LOCATION} \
107 -artifactRepository file:${LOCATION} \
108 -metadataRepositoryName "${NAME} Updates" \
Stephan Herrmann438548f2010-08-21 23:15:22 +0000109 -artifactRepositoryName "${NAME} Artifacts" \
110 -reusePack200Files -publishArtifacts
Stephan Herrmann56942e82010-06-14 19:00:17 +0000111ls -ltr *\.*
112
113
Stephan Herrmann438548f2010-08-21 23:15:22 +0000114echo "====Step 5: patch content for feature inclusion version range===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000115mv content.xml content.xml-orig
116xsltproc -o content.xml --stringparam version ${JDTVERSIONA}-${JDTVERSIONB} \
117 --stringparam versionnext ${JDTVERSIONA}-${JDTVERSIONB2} \
118 ../build/patch-content-xml.xsl content.xml-orig
119ls -ltr *\.*
120
Stephan Herrmann438548f2010-08-21 23:15:22 +0000121echo "====Step 6: archive raw meta data===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000122mkdir ../metadata/$OTDTVERSION
123cp *.xml ../metadata/$OTDTVERSION
124ls -ltr ../metadata/$OTDTVERSION/*.xml
125
Stephan Herrmann438548f2010-08-21 23:15:22 +0000126echo "====Step 7: generate category===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000127CATEGORYARGS="-categoryDefinition file:${BASE}/testrun/build-root/src/features/org.eclipse.objectteams.otdt/category.xml"
128echo "CATEGORYARGS = ${CATEGORYARGS}"
129java -jar ${LAUNCHER_PATH} -consoleLog -application ${CATPUB} \
130 -source ${LOCATION} \
131 -metadataRepository file:${LOCATION} \
132 ${CATEGORYARGS}
133ls -ltr *\.*
134
135
Stephan Herrmann438548f2010-08-21 23:15:22 +0000136echo "====Step 8: add download stats capability===="
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000137XSLT_FILE=${BASE}/bin/addDownloadStats.xsl
138
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000139if [ $# == 3 ]; then
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000140 mv artifacts.xml artifacts.xml.original
141 if grep p2.statsURI artifacts.xml.original ; then echo "p2.statsURI already defined: exiting"; exit 1; fi
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000142 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 +0000143fi
Stephan Herrmann56942e82010-06-14 19:00:17 +0000144
Stephan Herrmann438548f2010-08-21 23:15:22 +0000145echo "====Step 9: jar-up metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000146jar cf content.jar content.xml
147jar cf artifacts.jar artifacts.xml
Stephan Herrmann503c4232010-06-27 13:15:05 +0000148/bin/rm *.xml*
Stephan Herrmann56942e82010-06-14 19:00:17 +0000149ls -ltr *\.*
150
Stephan Herrmann438548f2010-08-21 23:15:22 +0000151echo "====Step 10: cleanup: remove symbolic links===="
Stephan Herrmann503c4232010-06-27 13:15:05 +0000152find . -type l -exec /bin/rm {} \;
153
Stephan Herrmann56942e82010-06-14 19:00:17 +0000154echo "====DONE===="