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