| #!/bin/sh |
| # |
| # Script to update PTP versions |
| # |
| # Usage: user_id update_versions ptp_version photran_version [branch] |
| # |
| # user_id - user id to use to clone repo |
| # ptp_version - new version string for PTP and Photran (e.g. "5.0.1") |
| # branch - alternate branch to use when updating versions |
| # |
| # Note: as of 9.1, PTP and Photran versions will be kept in sync |
| # |
| # A "qualifier" suffix will automatically be added to the version where appropriate |
| # |
| # If version numbers are updated on a branch other than master, it is recommended to run |
| # the command from the master branch: |
| # |
| # git merge -s ours origin/branch |
| # |
| # to mark the changes as merged. |
| |
| BRANCH=master |
| |
| if [ $# -lt 3 ]; then |
| echo "usage: update_versions user_id ptp_version [branch]" |
| exit 1 |
| fi |
| |
| user_id=$1 |
| ptp_version=$2 |
| |
| if [ $# -gt 3 ]; then |
| BRANCH=$4 |
| fi |
| |
| if [ -f fix_ptp_versions ]; then |
| echo "please remove fix_ptp_versions first" |
| exit 1 |
| fi |
| |
| mkdir fix_ptp_versions |
| cd fix_ptp_versions |
| |
| git clone ssh://${user_id}@git.eclipse.org:29418/ptp/org.eclipse.photran.git |
| (cd org.eclipse.photran && git checkout $BRANCH) |
| |
| git clone ssh://${user_id}@git.eclipse.org:29418/ptp/org.eclipse.ptp.git |
| (cd org.eclipse.ptp && git checkout $BRANCH) |
| |
| git clone ssh://${user_id}@git.eclipse.org:29418/ptp/org.eclipse.ptp.master.git |
| (cd org.eclipse.ptp.master && git checkout $BRANCH) |
| |
| PTP_PLUGINS="\ |
| releng/org.eclipse.ptp.aix \ |
| releng/org.eclipse.ptp.linux \ |
| releng/org.eclipse.ptp.macosx \ |
| releng/org.eclipse.ptp \ |
| debug/org.eclipse.ptp.debug.sdm \ |
| core/org.eclipse.ptp.utils \ |
| core/org.eclipse.ptp.proxy \ |
| core/org.eclipse.ptp.doc.isv \ |
| tools/sci/org.eclipse.ptp.sci" |
| |
| PTP_PRODUCTS="ptp sysmon" |
| |
| update_feature() { |
| sed -e "s/^\([ \t]*\)version=\"[0-9]\.[0-9]\.[0-9]\.qualifier\"/\1version=\"$2\.qualifier\"/" < $1/feature.xml > $1/feature.xml.tmp |
| mv $1/feature.xml.tmp $1/feature.xml |
| } |
| |
| update_product() { |
| sed -e "s/version=\"[0-9]\.[0-9]\.[0-9]/version=\"$2/" < $1.product > $1.product.tmp |
| mv $1.product.tmp $1.product |
| } |
| |
| update_manifest() { |
| sed -e "s/^Bundle-Version: *[0-9]\.[0-9]\.[0-9]\.qualifier/Bundle-Version: $2.qualifier/" < $1/META-INF/MANIFEST.MF > $1/META-INF/MANIFEST.MF.tmp |
| mv $1/META-INF/MANIFEST.MF.tmp $1/META-INF/MANIFEST.MF |
| } |
| |
| for product in $PTP_PRODUCTS; do |
| echo "Updating $product..." |
| (cd org.eclipse.ptp.master/*.${product}-product && \ |
| update_product $product $ptp_version) |
| done |
| |
| for feature in org.eclipse.photran/*-feature; do |
| echo "Updating $feature..." |
| update_feature $feature $ptp_version |
| done |
| |
| for feature in org.eclipse.ptp/releng/*-feature; do |
| echo "Updating $feature..." |
| update_feature $feature $ptp_version |
| done |
| |
| for feature in org.eclipse.ptp.master/*-feature; do |
| echo "Updating $feature..." |
| update_feature $feature $ptp_version |
| done |
| |
| for plugin in $PTP_PLUGINS; do |
| echo "Updating $plugin..." |
| update_manifest org.eclipse.ptp/$plugin $ptp_version |
| done |
| |
| (cd org.eclipse.photran && \ |
| mvn versions:set -DnewVersion="${ptp_version}-SNAPSHOT" && \ |
| mvn org.eclipse.tycho:tycho-versions-plugin:0.14.0:update-pom) |
| |
| (cd org.eclipse.ptp && \ |
| mvn versions:set -DnewVersion="${ptp_version}-SNAPSHOT" && \ |
| mvn org.eclipse.tycho:tycho-versions-plugin:0.14.0:update-pom) |
| |
| (cd org.eclipse.ptp.master && \ |
| mvn versions:set -DnewVersion="${ptp_version}-SNAPSHOT" && \ |
| mvn org.eclipse.tycho:tycho-versions-plugin:0.14.0:update-pom) |
| |
| find . -name pom.xml.versionsBackup -exec rm -f {} \; |
| |
| #(cd org.eclipse.photran && git commit -m "Update PTP & Photran versions" && git push) |
| #(cd org.eclipse.ptp && git commit -m "Update PTP & Photran versions" && git push) |
| #(cd org.eclipse.ptp.master && git commit -m "Update PTP & Photran versions" && git push) |
| |
| # |
| # Cleanup |
| # |
| #cd .. |
| #rm -rf fix_ptp_versions |
| |
| exit 0 |