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