blob: f9180e4bca0cb3244c0e853fd2a9f10cf41aeff9 [file] [log] [blame]
Stephan Herrmannff801a62016-11-01 15:01:00 +01001#!/bin/sh
2
Stephan Herrmann30789152016-11-01 15:44:32 +01003# TO BE SUPPLIED VIA ENV:
4# JAVA5
5# SIGN (unset or nosign)
6# PROMOTE (unset or true)
Stephan Herrmannff801a62016-11-01 15:01:00 +01007BASE=`pwd`
8STAGINGBASE=/opt/public/download-staging.priv/tools/objectteams
9UPDATES_BASE=/home/data/httpd/download.eclipse.org/objectteams/updates
10BUILD=${BASE}/releng/build-scripts/build
11METADATA=${BASE}/metadata
12export JAR_PROCESSOR_JAVA=java8
13
14# Find the master repository to build upon:
15if [ "$1" == "none" ]
16then
17 MASTER="none"
18 echo "Generating fresh new repository"
19else
20 MASTER=${UPDATES_BASE}/$1
21 if [ -r ${MASTER}/features ]
22 then
23 echo "Generating Repository based on ${MASTER}"
24 else
25 MASTER=${HOME}/shared/baseRepos/$1
26 if [ -r ${MASTER}/features ]
27 then
28 echo "Generating Repository based on ${MASTER}"
29 else
30 echo "No such repository ${MASTER}"
31 echo "Usage: $0 updateMasterRelativePath [ -nosign ] [ statsRepoId statsVersionId ]"
32 exit 1
33 fi
34 fi
35fi
36
37# Analyze the version number of the JDT feature as needed for patching content.xml later:
38JDTFEATURE=`ls -d ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_*`
39if echo $JDTFEATURE | grep "\.r"
40then
41 JDTVERSION="`echo ${JDTFEATURE} | cut -d '_' -f 2`_`echo ${JDTFEATURE} | cut -d '_' -f 3`"
42else
43 JDTVERSION=`echo ${JDTFEATURE} | cut -d '_' -f 2`
44fi
45JDTVERSIONA=`echo ${JDTVERSION} | cut -d '-' -f 1`
46JDTVERSIONB=`echo ${JDTVERSION} | cut -d '-' -f 2`
47echo "after first split: ${JDTVERSIONA} and ${JDTVERSIONB}"
48case ${JDTVERSIONB} in
49 ????)
50 #A=v20110813 B=0800
51 JDTVERSIONB2=`expr $JDTVERSIONB + 1`
52 JDTVERSIONB2=`printf "%04d" ${JDTVERSIONB2}`
53 JDTVERSION=${JDTVERSIONA}-${JDTVERSIONB}
54 JDTVERSIONNEXT=${JDTVERSIONA}-${JDTVERSIONB2}
55 ;;
56 *)
57 #A=3.8.0.v20110813 B=someunspeakablelonghashid
58 JDTVERSIONC1=`echo ${JDTVERSIONA} | cut -d 'v' -f 1`
59 JDTVERSIONC2=`echo ${JDTVERSIONA} | cut -d 'v' -f 2`
60 JDTVERSIONC3=`expr $JDTVERSIONC2 + 1`
61 JDTVERSION=${JDTVERSIONC1}v${JDTVERSIONC2}
62 JDTVERSIONNEXT=${JDTVERSIONC1}v${JDTVERSIONC3}
63 ;;
64esac
65# hardcode when unable to compute
66#JDTVERSION=${JDTVERSIONA}
67#JDTVERSIONNEXT=3.8.0.v20110728
68echo "JDT feature is ${JDTVERSION}"
69echo "Next ${JDTVERSIONNEXT}"
70if [ ! -r ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_${JDTVERSION} ]
71then
72 echo "JDT feature not correctly found in ${BASE}/testrun/build-root/eclipse/features"
73 exit 2
74fi
75OTDTVERSION=`cat ${BASE}/testrun/build-root/src/finalFeaturesVersions.properties|grep "objectteams.otdt="|cut -d '=' -f 2`
76echo "OTDTVERSION is $OTDTVERSION"
77
78# Configure for calling various p2 applications:
79LAUNCHER=`grep equinox.launcher_jar= ${BUILD}/run.properties | cut -d '=' -f 2`
80LAUNCHER_PATH=${BASE}/testrun/build-root/eclipse/plugins/${LAUNCHER}
81FABPUB=org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
82CATPUB=org.eclipse.equinox.p2.publisher.CategoryPublisher
83JARPROCESSOR=`ls ${BASE}/testrun/build-root/eclipse/plugins/org.eclipse.equinox.p2.jarprocessor_*.jar`
84NAME="Object Teams"
85
86echo "LAUNCHER_PATH = ${LAUNCHER_PATH}"
87echo "NAME = ${NAME}"
88
89echo "====Step 1: zip and request signing===="
90cd ${BASE}/testrun/updateSite
91JARS=`find . -name \*.jar -type f`
Stephan Herrmann30789152016-11-01 15:44:32 +010092if [ "${SIGN}" == "nosign" ]
Stephan Herrmannff801a62016-11-01 15:01:00 +010093then
Stephan Herrmannb5d54e72016-11-01 15:59:09 +010094 OTDTJAR=../otdt.jar
95 /bin/rm ${OTDTJAR}
96 zip ${OTDTJAR} ${JARS}
Stephan Herrmannff801a62016-11-01 15:01:00 +010097 echo "SKIPING SIGNING"
Stephan Herrmannff801a62016-11-01 15:01:00 +010098else
Stephan Herrmannb5d54e72016-11-01 15:59:09 +010099 /bin/rm ${STAGINGBASE}/in/otdt.jar
100 zip ${STAGINGBASE}/in/otdt.jar ${JARS}
101 OTDTJAR=${STAGINGBASE}/out/otdt.jar
102 /bin/rm ${OTDTJAR}
Stephan Herrmannff801a62016-11-01 15:01:00 +0100103 sign ${STAGINGBASE}/in/otdt.jar nomail ${STAGINGBASE}/out
Stephan Herrmannb5d54e72016-11-01 15:59:09 +0100104 until [ -r ${OTDTJAR} ]
105 do
106 sleep 10
107 echo -n "."
108 done
109 echo "Signing completed"
Stephan Herrmannff801a62016-11-01 15:01:00 +0100110fi
Stephan Herrmannff801a62016-11-01 15:01:00 +0100111
112
113echo "====Step 2: fill new repository===="
114if [ -r ${BASE}/stagingRepo ]
115then
116 /bin/rm -rf ${BASE}/stagingRepo
117fi
118mkdir ${BASE}/stagingRepo
119cd ${BASE}/stagingRepo
120if [ "$MASTER" != "none" ]
121then
122 mkdir features
123 (cd features; ln -s ${MASTER}/features/* .)
124 mkdir plugins
125 (cd plugins; ln -s ${MASTER}/plugins/* .)
126else
127 mkdir plugins
128 cp ${BASE}/testrun/updateSite/plugins/org.apache.bcel* plugins/
129fi
Stephan Herrmannb5d54e72016-11-01 15:59:09 +0100130unzip -n ${OTDTJAR}
131/bin/rm ${OTDTJAR}
Stephan Herrmannff801a62016-11-01 15:01:00 +0100132
133LOCATION=${BASE}/stagingRepo
134echo "LOCATION = ${LOCATION}"
135cd ${LOCATION}
136
137echo "====Step 3: pack jars ===="
138for dir in ${LOCATION}/features ${LOCATION}/plugins
139do
140 find ${dir} -type f -name \*.jar -exec \
141 ${JAVA5}/bin/java -jar ${JARPROCESSOR} -verbose -pack -outputDir ${dir} {} \;
142done
143
144
145echo "====Step 4: generate metadata===="
146java -jar ${LAUNCHER_PATH} -consoleLog -application ${FABPUB} \
147 -source ${LOCATION} \
148 -metadataRepository file:${LOCATION} \
149 -artifactRepository file:${LOCATION} \
150 -metadataRepositoryName "${NAME} Updates" \
151 -artifactRepositoryName "${NAME} Artifacts" \
152 -reusePack200Files -publishArtifacts
153ls -ltr *\.*
154
155
156echo "====Step 5: patch content for feature inclusion version range===="
157mv content.xml content.xml-orig
158xsltproc -o content.xml --stringparam version ${JDTVERSION} \
159 --stringparam versionnext ${JDTVERSIONNEXT} \
160 ${BUILD}/patch-content-xml.xsl content.xml-orig
161ls -ltr *\.*
162
163echo "====Step 6: archive raw meta data===="
164mkdir ${METADATA}/$OTDTVERSION
165cp *.xml ${METADATA}/$OTDTVERSION
166ls -ltr ${METADATA}/$OTDTVERSION/*.xml
167
168echo "====Step 7: generate category===="
169CATEGORYARGS="-categoryDefinition file:${BASE}/testrun/build-root/src/features/org.eclipse.objectteams.otdt/category.xml"
170echo "CATEGORYARGS = ${CATEGORYARGS}"
171java -jar ${LAUNCHER_PATH} -consoleLog -application ${CATPUB} \
172 -source ${LOCATION} \
173 -metadataRepository file:${LOCATION} \
174 ${CATEGORYARGS}
175ls -ltr *\.*
176
177
178echo "====Step 8: add download stats capability===="
179XSLT_FILE=${BASE}/releng/build-scripts/bin/addDownloadStats.xsl
180
181if [ $# == 3 ]; then
182 mv artifacts.xml artifacts.xml.original
183 if grep p2.statsURI artifacts.xml.original ; then echo "p2.statsURI already defined: exiting"; exit 1; fi
184 xsltproc -o artifacts.xml --stringparam repo "http://download.eclipse.org/stats/objectteams/${2}" --stringparam version $3 $XSLT_FILE artifacts.xml.original
185fi
186
187echo "====Step 9: jar-up metadata===="
188jar cf content.jar content.xml
189jar cf artifacts.jar artifacts.xml
190/bin/rm *.xml*
191ls -ltr *\.*
192
193echo "====Step 10: cleanup: remove symbolic links===="
194find . -type l -exec /bin/rm {} \;
195
Stephan Herrmannbad1f342016-11-01 15:51:16 +0100196if [ "${PROMOTE}" == "true" ]
Stephan Herrmann30789152016-11-01 15:44:32 +0100197then
198 if [ -d ${UPDATES_BASE}/${2} ]
199 then
200 BUILDID=`echo $OTDTVERSION | cut -d '.' -f 4`
201 DEST=${UPDATES_BASE}/${2}/${BUILDID}
202 cp -pr ${UPDATES_BASE}/${1} ${DEST}
203 cp -pr * ${DEST}/
204 ls -lR ${DEST}
205 fi
206fi
Stephan Herrmannff801a62016-11-01 15:01:00 +0100207echo "====DONE===="