blob: 4781b271cdc14ecbb78aa1f9a65cd42e8006b072 [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
Stephan Herrmann6ca7f4d2015-05-02 13:32:22 +02005export JAR_PROCESSOR_JAVA=java8
Stephan Herrmann56942e82010-06-14 19:00:17 +00006
7# Find the master repository to build upon:
Stephan Herrmanne8a04942010-07-03 07:45:41 +00008if [ "$1" == "none" ]
Stephan Herrmann56942e82010-06-14 19:00:17 +00009then
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010010 MASTER="none"
11 echo "Generating fresh new repository"
Stephan Herrmann56942e82010-06-14 19:00:17 +000012else
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010013 MASTER=${HOME}/downloads/objectteams/updates/$1
14 if [ -r ${MASTER}/features ]
15 then
16 echo "Generating Repository based on ${MASTER}"
17 else
18 MASTER=${HOME}/shared/baseRepos/$1
19 if [ -r ${MASTER}/features ]
20 then
21 echo "Generating Repository based on ${MASTER}"
22 else
23 echo "No such repository ${MASTER}"
24 echo "Usage: $0 updateMasterRelativePath [ -nosign ] [ statsRepoId statsVersionId ]"
25 exit 1
26 fi
27 fi
Stephan Herrmann56942e82010-06-14 19:00:17 +000028fi
29
30# Analyze the version number of the JDT feature as needed for patching content.xml later:
31JDTFEATURE=`ls -d ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_*`
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000032if echo $JDTFEATURE | grep "\.r"
33then
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010034 JDTVERSION="`echo ${JDTFEATURE} | cut -d '_' -f 2`_`echo ${JDTFEATURE} | cut -d '_' -f 3`"
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000035else
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010036 JDTVERSION=`echo ${JDTFEATURE} | cut -d '_' -f 2`
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000037fi
Stephan Herrmann56942e82010-06-14 19:00:17 +000038JDTVERSIONA=`echo ${JDTVERSION} | cut -d '-' -f 1`
39JDTVERSIONB=`echo ${JDTVERSION} | cut -d '-' -f 2`
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010040echo "after first split: ${JDTVERSIONA} and ${JDTVERSIONB}"
41case ${JDTVERSIONB} in
42 ????)
43 #A=v20110813 B=0800
44 JDTVERSIONB2=`expr $JDTVERSIONB + 1`
45 JDTVERSIONB2=`printf "%04d" ${JDTVERSIONB2}`
46 JDTVERSION=${JDTVERSIONA}-${JDTVERSIONB}
47 JDTVERSIONNEXT=${JDTVERSIONA}-${JDTVERSIONB2}
48 ;;
49 *)
50 #A=3.8.0.v20110813 B=someunspeakablelonghashid
51 JDTVERSIONC1=`echo ${JDTVERSIONA} | cut -d 'v' -f 1`
52 JDTVERSIONC2=`echo ${JDTVERSIONA} | cut -d 'v' -f 2`
53 JDTVERSIONC3=`expr $JDTVERSIONC2 + 1`
54 JDTVERSION=${JDTVERSIONC1}v${JDTVERSIONC2}
55 JDTVERSIONNEXT=${JDTVERSIONC1}v${JDTVERSIONC3}
56 ;;
57esac
Stephan Herrmann83356812011-06-03 08:55:59 +000058# hardcode when unable to compute
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000059#JDTVERSION=${JDTVERSIONA}
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010060#JDTVERSIONNEXT=3.8.0.v20110728
Stephan Herrmanna53f6d32011-03-30 01:14:24 +000061echo "JDT feature is ${JDTVERSION}"
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +010062echo "Next ${JDTVERSIONNEXT}"
Stephan Herrmann35026292013-05-18 23:30:09 +020063if [ ! -r ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_${JDTVERSION} ]
Stephan Herrmann56942e82010-06-14 19:00:17 +000064then
65 echo "JDT feature not correctly found in ${BASE}/testrun/build-root/eclipse/features"
66 exit 2
67fi
Stephan Herrmann176b44e2010-07-09 22:52:58 +000068OTDTVERSION=`cat ${BASE}/testrun/build-root/src/finalFeaturesVersions.properties|grep "objectteams.otdt="|cut -d '=' -f 2`
69echo "OTDTVERSION is $OTDTVERSION"
Stephan Herrmann56942e82010-06-14 19:00:17 +000070
71# Configure for calling various p2 applications:
72LAUNCHER=`grep equinox.launcher_jar= ${BASE}/build/run.properties | cut -d '=' -f 2`
73LAUNCHER_PATH=${BASE}/testrun/build-root/eclipse/plugins/${LAUNCHER}
74FABPUB=org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
75CATPUB=org.eclipse.equinox.p2.publisher.CategoryPublisher
Stephan Herrmann438548f2010-08-21 23:15:22 +000076JARPROCESSOR=`ls ${BASE}/testrun/build-root/eclipse/plugins/org.eclipse.equinox.p2.jarprocessor_*.jar`
Stephan Herrmann56942e82010-06-14 19:00:17 +000077NAME="Object Teams"
78
79echo "LAUNCHER_PATH = ${LAUNCHER_PATH}"
80echo "NAME = ${NAME}"
81
82echo "====Step 1: zip and request signing===="
83cd ${BASE}/testrun/updateSite
84JARS=`find . -name \*.jar -type f`
Stephan Herrmann0417f842016-03-20 01:16:24 +010085/bin/rm ${STAGINGBASE}/in/otdt.jar
86zip ${STAGINGBASE}/in/otdt.jar ${JARS}
Stephan Herrmann56942e82010-06-14 19:00:17 +000087if [ "$2" == "-nosign" ]
88then
89 echo "SKIPING SIGNING"
Stephan Herrmann0417f842016-03-20 01:16:24 +010090 /bin/mv ${STAGINGBASE}/in/otdt.jar ${STAGINGBASE}/out/otdt.jar
Stephan Herrmann8bbae122010-06-14 19:12:51 +000091 shift
Stephan Herrmann56942e82010-06-14 19:00:17 +000092else
Stephan Herrmann0417f842016-03-20 01:16:24 +010093 /bin/rm ${STAGINGBASE}/out/otdt.jar
94 sign ${STAGINGBASE}/in/otdt.jar nomail ${STAGINGBASE}/out
Stephan Herrmann56942e82010-06-14 19:00:17 +000095fi
Stephan Herrmann0417f842016-03-20 01:16:24 +010096until [ -r ${STAGINGBASE}/out/otdt.jar ]
Stephan Herrmann56942e82010-06-14 19:00:17 +000097do
98 sleep 10
99 echo -n "."
100done
101echo "Signing completed"
102
103
104echo "====Step 2: fill new repository===="
105if [ -r ${BASE}/stagingRepo ]
106then
107 /bin/rm -rf ${BASE}/stagingRepo
108fi
109mkdir ${BASE}/stagingRepo
110cd ${BASE}/stagingRepo
Stephan Herrmanne8a04942010-07-03 07:45:41 +0000111if [ "$MASTER" != "none" ]
112then
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +0100113 mkdir features
114 (cd features; ln -s ${MASTER}/features/* .)
115 mkdir plugins
116 (cd plugins; ln -s ${MASTER}/plugins/* .)
Stephan Herrmanne8a04942010-07-03 07:45:41 +0000117else
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +0100118 mkdir plugins
119 cp ${BASE}/testrun/updateSite/plugins/org.apache.bcel* plugins/
Stephan Herrmanne8a04942010-07-03 07:45:41 +0000120fi
Stephan Herrmann0417f842016-03-20 01:16:24 +0100121unzip -n ${STAGINGBASE}/out/otdt.jar
Stephan Herrmann56942e82010-06-14 19:00:17 +0000122
123LOCATION=${BASE}/stagingRepo
124echo "LOCATION = ${LOCATION}"
125cd ${LOCATION}
126
Stephan Herrmann438548f2010-08-21 23:15:22 +0000127echo "====Step 3: pack jars ===="
128for dir in ${LOCATION}/features ${LOCATION}/plugins
129do
130 find ${dir} -type f -name \*.jar -exec \
Stephan Herrmanna53f6d32011-03-30 01:14:24 +0000131 ${JAVA5}/bin/java -jar ${JARPROCESSOR} -verbose -pack -outputDir ${dir} {} \;
Stephan Herrmann438548f2010-08-21 23:15:22 +0000132done
Stephan Herrmann56942e82010-06-14 19:00:17 +0000133
Stephan Herrmann438548f2010-08-21 23:15:22 +0000134
135echo "====Step 4: generate metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000136java -jar ${LAUNCHER_PATH} -consoleLog -application ${FABPUB} \
137 -source ${LOCATION} \
138 -metadataRepository file:${LOCATION} \
139 -artifactRepository file:${LOCATION} \
140 -metadataRepositoryName "${NAME} Updates" \
Stephan Herrmann438548f2010-08-21 23:15:22 +0000141 -artifactRepositoryName "${NAME} Artifacts" \
142 -reusePack200Files -publishArtifacts
Stephan Herrmann56942e82010-06-14 19:00:17 +0000143ls -ltr *\.*
144
145
Stephan Herrmann438548f2010-08-21 23:15:22 +0000146echo "====Step 5: patch content for feature inclusion version range===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000147mv content.xml content.xml-orig
Stephan Herrmanna53f6d32011-03-30 01:14:24 +0000148xsltproc -o content.xml --stringparam version ${JDTVERSION} \
149 --stringparam versionnext ${JDTVERSIONNEXT} \
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000150 ../build/patch-content-xml.xsl content.xml-orig
151ls -ltr *\.*
152
Stephan Herrmann438548f2010-08-21 23:15:22 +0000153echo "====Step 6: archive raw meta data===="
Stephan Herrmann176b44e2010-07-09 22:52:58 +0000154mkdir ../metadata/$OTDTVERSION
155cp *.xml ../metadata/$OTDTVERSION
156ls -ltr ../metadata/$OTDTVERSION/*.xml
157
Stephan Herrmann438548f2010-08-21 23:15:22 +0000158echo "====Step 7: generate category===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000159CATEGORYARGS="-categoryDefinition file:${BASE}/testrun/build-root/src/features/org.eclipse.objectteams.otdt/category.xml"
160echo "CATEGORYARGS = ${CATEGORYARGS}"
161java -jar ${LAUNCHER_PATH} -consoleLog -application ${CATPUB} \
162 -source ${LOCATION} \
163 -metadataRepository file:${LOCATION} \
164 ${CATEGORYARGS}
165ls -ltr *\.*
166
167
Stephan Herrmann438548f2010-08-21 23:15:22 +0000168echo "====Step 8: add download stats capability===="
Stephan Herrmann8bbae122010-06-14 19:12:51 +0000169XSLT_FILE=${BASE}/bin/addDownloadStats.xsl
170
Stephan Herrmann0e446d82010-06-14 19:15:49 +0000171if [ $# == 3 ]; then
Stephan Herrmann7aafe9d2012-02-28 22:38:55 +0100172 mv artifacts.xml artifacts.xml.original
173 if grep p2.statsURI artifacts.xml.original ; then echo "p2.statsURI already defined: exiting"; exit 1; fi
174 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 +0000175fi
Stephan Herrmann56942e82010-06-14 19:00:17 +0000176
Stephan Herrmann438548f2010-08-21 23:15:22 +0000177echo "====Step 9: jar-up metadata===="
Stephan Herrmann56942e82010-06-14 19:00:17 +0000178jar cf content.jar content.xml
179jar cf artifacts.jar artifacts.xml
Stephan Herrmann503c4232010-06-27 13:15:05 +0000180/bin/rm *.xml*
Stephan Herrmann56942e82010-06-14 19:00:17 +0000181ls -ltr *\.*
182
Stephan Herrmann438548f2010-08-21 23:15:22 +0000183echo "====Step 10: cleanup: remove symbolic links===="
Stephan Herrmann503c4232010-06-27 13:15:05 +0000184find . -type l -exec /bin/rm {} \;
185
Stephan Herrmann56942e82010-06-14 19:00:17 +0000186echo "====DONE===="