blob: 3d3e75accacf16e41d68d90fa300b02f97f51a7a [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}
Stephan Herrmann83356812011-06-03 08:55:59 +000037# hardcode when unable to compute
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000038#JDTVERSION=${JDTVERSIONA}
Stephan Herrmann83356812011-06-03 08:55:59 +000039#JDTVERSIONNEXT=3.7.0.v20110332
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000040echo "JDT feature is ${JDTVERSION}"
41if [ ! -r ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_${JDTVERSION}-* ]
Stephan Herrmann56942e82010-06-14 19:00:17 +000042then
43 echo "JDT feature not correctly found in ${BASE}/testrun/build-root/eclipse/features"
44 exit 2
45fi
Stephan Herrmann176b44e2010-07-09 22:52:58 +000046OTDTVERSION=`cat ${BASE}/testrun/build-root/src/finalFeaturesVersions.properties|grep "objectteams.otdt="|cut -d '=' -f 2`
47echo "OTDTVERSION is $OTDTVERSION"
Stephan Herrmann56942e82010-06-14 19:00:17 +000048
49# Configure for calling various p2 applications:
50LAUNCHER=`grep equinox.launcher_jar= ${BASE}/build/run.properties | cut -d '=' -f 2`
51LAUNCHER_PATH=${BASE}/testrun/build-root/eclipse/plugins/${LAUNCHER}
52FABPUB=org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
53CATPUB=org.eclipse.equinox.p2.publisher.CategoryPublisher
Stephan Herrmann438548f2010-08-21 23:15:22 +000054JARPROCESSOR=`ls ${BASE}/testrun/build-root/eclipse/plugins/org.eclipse.equinox.p2.jarprocessor_*.jar`
Stephan Herrmann56942e82010-06-14 19:00:17 +000055NAME="Object Teams"
56
57echo "LAUNCHER_PATH = ${LAUNCHER_PATH}"
58echo "NAME = ${NAME}"
59
60echo "====Step 1: zip and request signing===="
61cd ${BASE}/testrun/updateSite
62JARS=`find . -name \*.jar -type f`
Stephan Herrmann8346e1c2010-06-20 18:07:10 +000063/bin/rm ${STAGINGBASE}/in/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +000064zip ${STAGINGBASE}/in/otdt.zip ${JARS}
65if [ "$2" == "-nosign" ]
66then
67 echo "SKIPING SIGNING"
Stephan Herrmanncb88cf12010-07-22 21:24:10 +000068 /bin/mv ${STAGINGBASE}/in/otdt.zip ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann8bbae122010-06-14 19:12:51 +000069 shift
Stephan Herrmann56942e82010-06-14 19:00:17 +000070else
71 /bin/rm ${STAGINGBASE}/out/otdt.zip
72 sign ${STAGINGBASE}/in/otdt.zip nomail ${STAGINGBASE}/out
73fi
74until [ -r ${STAGINGBASE}/out/otdt.zip ]
75do
76 sleep 10
77 echo -n "."
78done
79echo "Signing completed"
80
81
82echo "====Step 2: fill new repository===="
83if [ -r ${BASE}/stagingRepo ]
84then
85 /bin/rm -rf ${BASE}/stagingRepo
86fi
87mkdir ${BASE}/stagingRepo
88cd ${BASE}/stagingRepo
Stephan Herrmanne8a04942010-07-03 07:45:41 +000089if [ "$MASTER" != "none" ]
90then
91 mkdir features
92 (cd features; ln -s ${MASTER}/features/* .)
93 mkdir plugins
94 (cd plugins; ln -s ${MASTER}/plugins/* .)
95else
96 mkdir plugins
97 cp ${BASE}/testrun/updateSite/plugins/org.apache.bcel* plugins/
98fi
Stephan Herrmann503c4232010-06-27 13:15:05 +000099unzip -n ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +0000100
101LOCATION=${BASE}/stagingRepo
102echo "LOCATION = ${LOCATION}"
103cd ${LOCATION}
104
Stephan Herrmann438548f2010-08-21 23:15:22 +0000105echo "====Step 3: pack jars ===="
106for dir in ${LOCATION}/features ${LOCATION}/plugins
107do
108 find ${dir} -type f -name \*.jar -exec \
Stephan Herrmanna53f6d32011-03-30 01:14:24 +0000109 ${JAVA5}/bin/java -jar ${JARPROCESSOR} -verbose -pack -outputDir ${dir} {} \;
Stephan Herrmann438548f2010-08-21 23:15:22 +0000110done
Stephan Herrmann56942e82010-06-14 19:00:17 +0000111
Stephan Herrmann438548f2010-08-21 23:15:22 +0000112
113echo "====Step 4: generate metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000114java -jar ${LAUNCHER_PATH} -consoleLog -application ${FABPUB} \
115 -source ${LOCATION} \
116 -metadataRepository file:${LOCATION} \
117 -artifactRepository file:${LOCATION} \
118 -metadataRepositoryName "${NAME} Updates" \
Stephan Herrmann438548f2010-08-21 23:15:22 +0000119 -artifactRepositoryName "${NAME} Artifacts" \
120 -reusePack200Files -publishArtifacts
Stephan Herrmann56942e82010-06-14 19:00:17 +0000121ls -ltr *\.*
122
123
Stephan Herrmann438548f2010-08-21 23:15:22 +0000124echo "====Step 5: patch content for feature inclusion version range===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000125mv content.xml content.xml-orig
Stephan Herrmanna53f6d32011-03-30 01:14:24 +0000126xsltproc -o content.xml --stringparam version ${JDTVERSION} \
127 --stringparam versionnext ${JDTVERSIONNEXT} \
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000128 ../build/patch-content-xml.xsl content.xml-orig
129ls -ltr *\.*
130
Stephan Herrmann438548f2010-08-21 23:15:22 +0000131echo "====Step 6: archive raw meta data===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000132mkdir ../metadata/$OTDTVERSION
133cp *.xml ../metadata/$OTDTVERSION
134ls -ltr ../metadata/$OTDTVERSION/*.xml
135
Stephan Herrmann438548f2010-08-21 23:15:22 +0000136echo "====Step 7: generate category===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000137CATEGORYARGS="-categoryDefinition file:${BASE}/testrun/build-root/src/features/org.eclipse.objectteams.otdt/category.xml"
138echo "CATEGORYARGS = ${CATEGORYARGS}"
139java -jar ${LAUNCHER_PATH} -consoleLog -application ${CATPUB} \
140 -source ${LOCATION} \
141 -metadataRepository file:${LOCATION} \
142 ${CATEGORYARGS}
143ls -ltr *\.*
144
145
Stephan Herrmann438548f2010-08-21 23:15:22 +0000146echo "====Step 8: add download stats capability===="
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000147XSLT_FILE=${BASE}/bin/addDownloadStats.xsl
148
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000149if [ $# == 3 ]; then
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000150 mv artifacts.xml artifacts.xml.original
151 if grep p2.statsURI artifacts.xml.original ; then echo "p2.statsURI already defined: exiting"; exit 1; fi
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000152 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 +0000153fi
Stephan Herrmann56942e82010-06-14 19:00:17 +0000154
Stephan Herrmann438548f2010-08-21 23:15:22 +0000155echo "====Step 9: jar-up metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000156jar cf content.jar content.xml
157jar cf artifacts.jar artifacts.xml
Stephan Herrmann503c4232010-06-27 13:15:05 +0000158/bin/rm *.xml*
Stephan Herrmann56942e82010-06-14 19:00:17 +0000159ls -ltr *\.*
160
Stephan Herrmann438548f2010-08-21 23:15:22 +0000161echo "====Step 10: cleanup: remove symbolic links===="
Stephan Herrmann503c4232010-06-27 13:15:05 +0000162find . -type l -exec /bin/rm {} \;
163
Stephan Herrmann56942e82010-06-14 19:00:17 +0000164echo "====DONE===="