Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | BASE=/shared/tools/objectteams |
| 4 | STAGINGBASE=/opt/public/download-staging.priv/tools/objectteams |
Stephan Herrmann | 6ca7f4d | 2015-05-02 13:32:22 +0200 | [diff] [blame] | 5 | export JAR_PROCESSOR_JAVA=java8 |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 6 | |
| 7 | # Find the master repository to build upon: |
Stephan Herrmann | e8a0494 | 2010-07-03 07:45:41 +0000 | [diff] [blame] | 8 | if [ "$1" == "none" ] |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 9 | then |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 10 | MASTER="none" |
| 11 | echo "Generating fresh new repository" |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 12 | else |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 13 | 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 Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 28 | fi |
| 29 | |
| 30 | # Analyze the version number of the JDT feature as needed for patching content.xml later: |
| 31 | JDTFEATURE=`ls -d ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_*` |
Stephan Herrmann | a53f6d3 | 2011-03-30 01:14:24 +0000 | [diff] [blame] | 32 | if echo $JDTFEATURE | grep "\.r" |
| 33 | then |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 34 | JDTVERSION="`echo ${JDTFEATURE} | cut -d '_' -f 2`_`echo ${JDTFEATURE} | cut -d '_' -f 3`" |
Stephan Herrmann | a53f6d3 | 2011-03-30 01:14:24 +0000 | [diff] [blame] | 35 | else |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 36 | JDTVERSION=`echo ${JDTFEATURE} | cut -d '_' -f 2` |
Stephan Herrmann | a53f6d3 | 2011-03-30 01:14:24 +0000 | [diff] [blame] | 37 | fi |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 38 | JDTVERSIONA=`echo ${JDTVERSION} | cut -d '-' -f 1` |
| 39 | JDTVERSIONB=`echo ${JDTVERSION} | cut -d '-' -f 2` |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 40 | echo "after first split: ${JDTVERSIONA} and ${JDTVERSIONB}" |
| 41 | case ${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 | ;; |
| 57 | esac |
Stephan Herrmann | 8335681 | 2011-06-03 08:55:59 +0000 | [diff] [blame] | 58 | # hardcode when unable to compute |
Stephan Herrmann | a53f6d3 | 2011-03-30 01:14:24 +0000 | [diff] [blame] | 59 | #JDTVERSION=${JDTVERSIONA} |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 60 | #JDTVERSIONNEXT=3.8.0.v20110728 |
Stephan Herrmann | a53f6d3 | 2011-03-30 01:14:24 +0000 | [diff] [blame] | 61 | echo "JDT feature is ${JDTVERSION}" |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 62 | echo "Next ${JDTVERSIONNEXT}" |
Stephan Herrmann | 3502629 | 2013-05-18 23:30:09 +0200 | [diff] [blame] | 63 | if [ ! -r ${BASE}/testrun/build-root/eclipse/features/org.eclipse.jdt_${JDTVERSION} ] |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 64 | then |
| 65 | echo "JDT feature not correctly found in ${BASE}/testrun/build-root/eclipse/features" |
| 66 | exit 2 |
| 67 | fi |
Stephan Herrmann | 176b44e | 2010-07-09 22:52:58 +0000 | [diff] [blame] | 68 | OTDTVERSION=`cat ${BASE}/testrun/build-root/src/finalFeaturesVersions.properties|grep "objectteams.otdt="|cut -d '=' -f 2` |
| 69 | echo "OTDTVERSION is $OTDTVERSION" |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 70 | |
| 71 | # Configure for calling various p2 applications: |
| 72 | LAUNCHER=`grep equinox.launcher_jar= ${BASE}/build/run.properties | cut -d '=' -f 2` |
| 73 | LAUNCHER_PATH=${BASE}/testrun/build-root/eclipse/plugins/${LAUNCHER} |
| 74 | FABPUB=org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher |
| 75 | CATPUB=org.eclipse.equinox.p2.publisher.CategoryPublisher |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 76 | JARPROCESSOR=`ls ${BASE}/testrun/build-root/eclipse/plugins/org.eclipse.equinox.p2.jarprocessor_*.jar` |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 77 | NAME="Object Teams" |
| 78 | |
| 79 | echo "LAUNCHER_PATH = ${LAUNCHER_PATH}" |
| 80 | echo "NAME = ${NAME}" |
| 81 | |
| 82 | echo "====Step 1: zip and request signing====" |
| 83 | cd ${BASE}/testrun/updateSite |
| 84 | JARS=`find . -name \*.jar -type f` |
Stephan Herrmann | 0417f84 | 2016-03-20 01:16:24 +0100 | [diff] [blame] | 85 | /bin/rm ${STAGINGBASE}/in/otdt.jar |
| 86 | zip ${STAGINGBASE}/in/otdt.jar ${JARS} |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 87 | if [ "$2" == "-nosign" ] |
| 88 | then |
| 89 | echo "SKIPING SIGNING" |
Stephan Herrmann | 0417f84 | 2016-03-20 01:16:24 +0100 | [diff] [blame] | 90 | /bin/mv ${STAGINGBASE}/in/otdt.jar ${STAGINGBASE}/out/otdt.jar |
Stephan Herrmann | 8bbae12 | 2010-06-14 19:12:51 +0000 | [diff] [blame] | 91 | shift |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 92 | else |
Stephan Herrmann | 0417f84 | 2016-03-20 01:16:24 +0100 | [diff] [blame] | 93 | /bin/rm ${STAGINGBASE}/out/otdt.jar |
| 94 | sign ${STAGINGBASE}/in/otdt.jar nomail ${STAGINGBASE}/out |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 95 | fi |
Stephan Herrmann | 0417f84 | 2016-03-20 01:16:24 +0100 | [diff] [blame] | 96 | until [ -r ${STAGINGBASE}/out/otdt.jar ] |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 97 | do |
| 98 | sleep 10 |
| 99 | echo -n "." |
| 100 | done |
| 101 | echo "Signing completed" |
| 102 | |
| 103 | |
| 104 | echo "====Step 2: fill new repository====" |
| 105 | if [ -r ${BASE}/stagingRepo ] |
| 106 | then |
| 107 | /bin/rm -rf ${BASE}/stagingRepo |
| 108 | fi |
| 109 | mkdir ${BASE}/stagingRepo |
| 110 | cd ${BASE}/stagingRepo |
Stephan Herrmann | e8a0494 | 2010-07-03 07:45:41 +0000 | [diff] [blame] | 111 | if [ "$MASTER" != "none" ] |
| 112 | then |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 113 | mkdir features |
| 114 | (cd features; ln -s ${MASTER}/features/* .) |
| 115 | mkdir plugins |
| 116 | (cd plugins; ln -s ${MASTER}/plugins/* .) |
Stephan Herrmann | e8a0494 | 2010-07-03 07:45:41 +0000 | [diff] [blame] | 117 | else |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 118 | mkdir plugins |
| 119 | cp ${BASE}/testrun/updateSite/plugins/org.apache.bcel* plugins/ |
Stephan Herrmann | e8a0494 | 2010-07-03 07:45:41 +0000 | [diff] [blame] | 120 | fi |
Stephan Herrmann | 0417f84 | 2016-03-20 01:16:24 +0100 | [diff] [blame] | 121 | unzip -n ${STAGINGBASE}/out/otdt.jar |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 122 | |
| 123 | LOCATION=${BASE}/stagingRepo |
| 124 | echo "LOCATION = ${LOCATION}" |
| 125 | cd ${LOCATION} |
| 126 | |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 127 | echo "====Step 3: pack jars ====" |
| 128 | for dir in ${LOCATION}/features ${LOCATION}/plugins |
| 129 | do |
| 130 | find ${dir} -type f -name \*.jar -exec \ |
Stephan Herrmann | a53f6d3 | 2011-03-30 01:14:24 +0000 | [diff] [blame] | 131 | ${JAVA5}/bin/java -jar ${JARPROCESSOR} -verbose -pack -outputDir ${dir} {} \; |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 132 | done |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 133 | |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 134 | |
| 135 | echo "====Step 4: generate metadata====" |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 136 | java -jar ${LAUNCHER_PATH} -consoleLog -application ${FABPUB} \ |
| 137 | -source ${LOCATION} \ |
| 138 | -metadataRepository file:${LOCATION} \ |
| 139 | -artifactRepository file:${LOCATION} \ |
| 140 | -metadataRepositoryName "${NAME} Updates" \ |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 141 | -artifactRepositoryName "${NAME} Artifacts" \ |
| 142 | -reusePack200Files -publishArtifacts |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 143 | ls -ltr *\.* |
| 144 | |
| 145 | |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 146 | echo "====Step 5: patch content for feature inclusion version range====" |
Stephan Herrmann | 176b44e | 2010-07-09 22:52:58 +0000 | [diff] [blame] | 147 | mv content.xml content.xml-orig |
Stephan Herrmann | a53f6d3 | 2011-03-30 01:14:24 +0000 | [diff] [blame] | 148 | xsltproc -o content.xml --stringparam version ${JDTVERSION} \ |
| 149 | --stringparam versionnext ${JDTVERSIONNEXT} \ |
Stephan Herrmann | 176b44e | 2010-07-09 22:52:58 +0000 | [diff] [blame] | 150 | ../build/patch-content-xml.xsl content.xml-orig |
| 151 | ls -ltr *\.* |
| 152 | |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 153 | echo "====Step 6: archive raw meta data====" |
Stephan Herrmann | 176b44e | 2010-07-09 22:52:58 +0000 | [diff] [blame] | 154 | mkdir ../metadata/$OTDTVERSION |
| 155 | cp *.xml ../metadata/$OTDTVERSION |
| 156 | ls -ltr ../metadata/$OTDTVERSION/*.xml |
| 157 | |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 158 | echo "====Step 7: generate category====" |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 159 | CATEGORYARGS="-categoryDefinition file:${BASE}/testrun/build-root/src/features/org.eclipse.objectteams.otdt/category.xml" |
| 160 | echo "CATEGORYARGS = ${CATEGORYARGS}" |
| 161 | java -jar ${LAUNCHER_PATH} -consoleLog -application ${CATPUB} \ |
| 162 | -source ${LOCATION} \ |
| 163 | -metadataRepository file:${LOCATION} \ |
| 164 | ${CATEGORYARGS} |
| 165 | ls -ltr *\.* |
| 166 | |
| 167 | |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 168 | echo "====Step 8: add download stats capability====" |
Stephan Herrmann | 8bbae12 | 2010-06-14 19:12:51 +0000 | [diff] [blame] | 169 | XSLT_FILE=${BASE}/bin/addDownloadStats.xsl |
| 170 | |
Stephan Herrmann | 0e446d8 | 2010-06-14 19:15:49 +0000 | [diff] [blame] | 171 | if [ $# == 3 ]; then |
Stephan Herrmann | 7aafe9d | 2012-02-28 22:38:55 +0100 | [diff] [blame] | 172 | 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 Herrmann | 8bbae12 | 2010-06-14 19:12:51 +0000 | [diff] [blame] | 175 | fi |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 176 | |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 177 | echo "====Step 9: jar-up metadata====" |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 178 | jar cf content.jar content.xml |
| 179 | jar cf artifacts.jar artifacts.xml |
Stephan Herrmann | 503c423 | 2010-06-27 13:15:05 +0000 | [diff] [blame] | 180 | /bin/rm *.xml* |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 181 | ls -ltr *\.* |
| 182 | |
Stephan Herrmann | 438548f | 2010-08-21 23:15:22 +0000 | [diff] [blame] | 183 | echo "====Step 10: cleanup: remove symbolic links====" |
Stephan Herrmann | 503c423 | 2010-06-27 13:15:05 +0000 | [diff] [blame] | 184 | find . -type l -exec /bin/rm {} \; |
| 185 | |
Stephan Herrmann | 56942e8 | 2010-06-14 19:00:17 +0000 | [diff] [blame] | 186 | echo "====DONE====" |