blob: df72fb7cea246ab55bf0ee79f79993703ad4a216 [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 Herrmann7aafe9d2012-02-28 22:38:55 +01009 MASTER="none"
10 echo "Generating fresh new repository"
Stephan Herrmann56942e82010-06-14 19:00:17 +000011else
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010012 MASTER=${HOME}/downloads/objectteams/updates/$1
13 if [ -r ${MASTER}/features ]
14 then
15 echo "Generating Repository based on ${MASTER}"
16 else
17 MASTER=${HOME}/shared/baseRepos/$1
18 if [ -r ${MASTER}/features ]
19 then
20 echo "Generating Repository based on ${MASTER}"
21 else
22 echo "No such repository ${MASTER}"
23 echo "Usage: $0 updateMasterRelativePath [ -nosign ] [ statsRepoId statsVersionId ]"
24 exit 1
25 fi
26 fi
Stephan Herrmann56942e82010-06-14 19:00:17 +000027fi
28
29# Analyze the version number of the JDT feature as needed for patching content.xml later:
30JDTFEATURE=`ls -d ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_*`
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000031if echo $JDTFEATURE | grep "\.r"
32then
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010033 JDTVERSION="`echo ${JDTFEATURE} | cut -d '_' -f 2`_`echo ${JDTFEATURE} | cut -d '_' -f 3`"
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000034else
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010035 JDTVERSION=`echo ${JDTFEATURE} | cut -d '_' -f 2`
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000036fi
Stephan Herrmann56942e82010-06-14 19:00:17 +000037JDTVERSIONA=`echo ${JDTVERSION} | cut -d '-' -f 1`
38JDTVERSIONB=`echo ${JDTVERSION} | cut -d '-' -f 2`
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010039echo "after first split: ${JDTVERSIONA} and ${JDTVERSIONB}"
40case ${JDTVERSIONB} in
41 ????)
42 #A=v20110813 B=0800
43 JDTVERSIONB2=`expr $JDTVERSIONB + 1`
44 JDTVERSIONB2=`printf "%04d" ${JDTVERSIONB2}`
45 JDTVERSION=${JDTVERSIONA}-${JDTVERSIONB}
46 JDTVERSIONNEXT=${JDTVERSIONA}-${JDTVERSIONB2}
47 ;;
48 *)
49 #A=3.8.0.v20110813 B=someunspeakablelonghashid
50 JDTVERSIONC1=`echo ${JDTVERSIONA} | cut -d 'v' -f 1`
51 JDTVERSIONC2=`echo ${JDTVERSIONA} | cut -d 'v' -f 2`
52 JDTVERSIONC3=`expr $JDTVERSIONC2 + 1`
53 JDTVERSION=${JDTVERSIONC1}v${JDTVERSIONC2}
54 JDTVERSIONNEXT=${JDTVERSIONC1}v${JDTVERSIONC3}
55 ;;
56esac
Stephan Herrmann83356812011-06-03 08:55:59 +000057# hardcode when unable to compute
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000058#JDTVERSION=${JDTVERSIONA}
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010059#JDTVERSIONNEXT=3.8.0.v20110728
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000060echo "JDT feature is ${JDTVERSION}"
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010061echo "Next ${JDTVERSIONNEXT}"
Stephan Herrmann35026292013-05-18 23:30:09 +020062if [ ! -r ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_${JDTVERSION} ]
Stephan Herrmann56942e82010-06-14 19:00:17 +000063then
64 echo "JDT feature not correctly found in ${BASE}/testrun/build-root/eclipse/features"
65 exit 2
66fi
Stephan Herrmann176b44e2010-07-09 22:52:58 +000067OTDTVERSION=`cat ${BASE}/testrun/build-root/src/finalFeaturesVersions.properties|grep "objectteams.otdt="|cut -d '=' -f 2`
68echo "OTDTVERSION is $OTDTVERSION"
Stephan Herrmann56942e82010-06-14 19:00:17 +000069
70# Configure for calling various p2 applications:
71LAUNCHER=`grep equinox.launcher_jar= ${BASE}/build/run.properties | cut -d '=' -f 2`
72LAUNCHER_PATH=${BASE}/testrun/build-root/eclipse/plugins/${LAUNCHER}
73FABPUB=org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
74CATPUB=org.eclipse.equinox.p2.publisher.CategoryPublisher
Stephan Herrmann438548f2010-08-21 23:15:22 +000075JARPROCESSOR=`ls ${BASE}/testrun/build-root/eclipse/plugins/org.eclipse.equinox.p2.jarprocessor_*.jar`
Stephan Herrmann56942e82010-06-14 19:00:17 +000076NAME="Object Teams"
77
78echo "LAUNCHER_PATH = ${LAUNCHER_PATH}"
79echo "NAME = ${NAME}"
80
81echo "====Step 1: zip and request signing===="
82cd ${BASE}/testrun/updateSite
83JARS=`find . -name \*.jar -type f`
Stephan Herrmann8346e1c2010-06-20 18:07:10 +000084/bin/rm ${STAGINGBASE}/in/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +000085zip ${STAGINGBASE}/in/otdt.zip ${JARS}
86if [ "$2" == "-nosign" ]
87then
88 echo "SKIPING SIGNING"
Stephan Herrmanncb88cf12010-07-22 21:24:10 +000089 /bin/mv ${STAGINGBASE}/in/otdt.zip ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann8bbae122010-06-14 19:12:51 +000090 shift
Stephan Herrmann56942e82010-06-14 19:00:17 +000091else
92 /bin/rm ${STAGINGBASE}/out/otdt.zip
93 sign ${STAGINGBASE}/in/otdt.zip nomail ${STAGINGBASE}/out
94fi
95until [ -r ${STAGINGBASE}/out/otdt.zip ]
96do
97 sleep 10
98 echo -n "."
99done
100echo "Signing completed"
101
102
103echo "====Step 2: fill new repository===="
104if [ -r ${BASE}/stagingRepo ]
105then
106 /bin/rm -rf ${BASE}/stagingRepo
107fi
108mkdir ${BASE}/stagingRepo
109cd ${BASE}/stagingRepo
Stephan Herrmanne8a04942010-07-03 07:45:41 +0000110if [ "$MASTER" != "none" ]
111then
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +0100112 mkdir features
113 (cd features; ln -s ${MASTER}/features/* .)
114 mkdir plugins
115 (cd plugins; ln -s ${MASTER}/plugins/* .)
Stephan Herrmanne8a04942010-07-03 07:45:41 +0000116else
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +0100117 mkdir plugins
118 cp ${BASE}/testrun/updateSite/plugins/org.apache.bcel* plugins/
Stephan Herrmanne8a04942010-07-03 07:45:41 +0000119fi
Stephan Herrmann503c4232010-06-27 13:15:05 +0000120unzip -n ${STAGINGBASE}/out/otdt.zip
Stephan Herrmann56942e82010-06-14 19:00:17 +0000121
122LOCATION=${BASE}/stagingRepo
123echo "LOCATION = ${LOCATION}"
124cd ${LOCATION}
125
Stephan Herrmann438548f2010-08-21 23:15:22 +0000126echo "====Step 3: pack jars ===="
127for dir in ${LOCATION}/features ${LOCATION}/plugins
128do
129 find ${dir} -type f -name \*.jar -exec \
Stephan Herrmanna53f6d32011-03-30 01:14:24 +0000130 ${JAVA5}/bin/java -jar ${JARPROCESSOR} -verbose -pack -outputDir ${dir} {} \;
Stephan Herrmann438548f2010-08-21 23:15:22 +0000131done
Stephan Herrmann56942e82010-06-14 19:00:17 +0000132
Stephan Herrmann438548f2010-08-21 23:15:22 +0000133
134echo "====Step 4: generate metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000135java -jar ${LAUNCHER_PATH} -consoleLog -application ${FABPUB} \
136 -source ${LOCATION} \
137 -metadataRepository file:${LOCATION} \
138 -artifactRepository file:${LOCATION} \
139 -metadataRepositoryName "${NAME} Updates" \
Stephan Herrmann438548f2010-08-21 23:15:22 +0000140 -artifactRepositoryName "${NAME} Artifacts" \
141 -reusePack200Files -publishArtifacts
Stephan Herrmann56942e82010-06-14 19:00:17 +0000142ls -ltr *\.*
143
144
Stephan Herrmann438548f2010-08-21 23:15:22 +0000145echo "====Step 5: patch content for feature inclusion version range===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000146mv content.xml content.xml-orig
Stephan Herrmanna53f6d32011-03-30 01:14:24 +0000147xsltproc -o content.xml --stringparam version ${JDTVERSION} \
148 --stringparam versionnext ${JDTVERSIONNEXT} \
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000149 ../build/patch-content-xml.xsl content.xml-orig
150ls -ltr *\.*
151
Stephan Herrmann438548f2010-08-21 23:15:22 +0000152echo "====Step 6: archive raw meta data===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000153mkdir ../metadata/$OTDTVERSION
154cp *.xml ../metadata/$OTDTVERSION
155ls -ltr ../metadata/$OTDTVERSION/*.xml
156
Stephan Herrmann438548f2010-08-21 23:15:22 +0000157echo "====Step 7: generate category===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000158CATEGORYARGS="-categoryDefinition file:${BASE}/testrun/build-root/src/features/org.eclipse.objectteams.otdt/category.xml"
159echo "CATEGORYARGS = ${CATEGORYARGS}"
160java -jar ${LAUNCHER_PATH} -consoleLog -application ${CATPUB} \
161 -source ${LOCATION} \
162 -metadataRepository file:${LOCATION} \
163 ${CATEGORYARGS}
164ls -ltr *\.*
165
166
Stephan Herrmann438548f2010-08-21 23:15:22 +0000167echo "====Step 8: add download stats capability===="
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000168XSLT_FILE=${BASE}/bin/addDownloadStats.xsl
169
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000170if [ $# == 3 ]; then
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +0100171 mv artifacts.xml artifacts.xml.original
172 if grep p2.statsURI artifacts.xml.original ; then echo "p2.statsURI already defined: exiting"; exit 1; fi
173 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 +0000174fi
Stephan Herrmann56942e82010-06-14 19:00:17 +0000175
Stephan Herrmann438548f2010-08-21 23:15:22 +0000176echo "====Step 9: jar-up metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000177jar cf content.jar content.xml
178jar cf artifacts.jar artifacts.xml
Stephan Herrmann503c4232010-06-27 13:15:05 +0000179/bin/rm *.xml*
Stephan Herrmann56942e82010-06-14 19:00:17 +0000180ls -ltr *\.*
181
Stephan Herrmann438548f2010-08-21 23:15:22 +0000182echo "====Step 10: cleanup: remove symbolic links===="
Stephan Herrmann503c4232010-06-27 13:15:05 +0000183find . -type l -exec /bin/rm {} \;
184
Stephan Herrmann56942e82010-06-14 19:00:17 +0000185echo "====DONE===="