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