From: <jos...@us...> - 2011-01-13 10:54:22
|
Revision: 7147 http://geonetwork.svn.sourceforge.net/geonetwork/?rev=7147&view=rev Author: josegar74 Date: 2011-01-13 10:54:16 +0000 (Thu, 13 Jan 2011) Log Message: ----------- Scripts improvements provided by Jeroen: OS check, parameter input format validation and reset version script Modified Paths: -------------- trunk/updateBranchVersions.sh trunk/updateReleaseVersions.sh Added Paths: ----------- trunk/resetReleaseVersions.sh Added: trunk/resetReleaseVersions.sh =================================================================== --- trunk/resetReleaseVersions.sh (rev 0) +++ trunk/resetReleaseVersions.sh 2011-01-13 10:54:16 UTC (rev 7147) @@ -0,0 +1,73 @@ +#!/bin/bash + +# Usage to reset a version number from e.g. 2.7.1 to 2.7.0 +# In root folder of branch code: ./resetReleaseVersions.sh 2.7.1 2.7.0 + +version="$1" +new_version="$2" + +function showUsage +{ + echo -e "\nThis script is used to reset a version number from e.g. 2.7.1 to 2.7.0" + echo + echo -e "Usage: ./`basename $0 $1` actual_version next_version" + echo + echo -e "Example to update file versions from 2.7.0 to 2.7.1:" + echo -e "\t./`basename $0 $1` 2.7.0 2.7.1" + echo +} + +if [ "$1" = "-h" ] +then + showUsage + exit +fi + +if [ $# -ne 2 ] +then + showUsage + exit +fi + + +if [[ $1 != [0-9].[0-9].[0-9] ]]; then + echo + echo 'Update failed due to incorrect versionnumber format: ' $1 + echo 'The format should be three numbers separated by dots. e.g.: 2.7.0' + echo + echo "Usage: ./`basename $0 $1` 2.7.1 2.7.0" + echo + exit +fi + +if [[ $2 != [0-9].[0-9].[0-9] ]]; then + echo + echo 'Update failed due to incorrect new versionnumber format (' $2 ')' + echo 'The format should be three numbers separated by dots. e.g.: 2.7.1' + echo + echo "Usage: ./`basename $0 $1` 2.7.1 2.7.0" + echo + exit +fi + +# Note: In MacOS (darwin10.0) sed requires -i .bak as option to work properly +if [[ $OSTYPE == 'darwin10.0' ]]; then + sedopt='-i .bak' +else + sedopt='-i' +fi + +echo +echo 'Your Operating System is' $OSTYPE +echo 'sed will use the following option: ' $sedopt +echo + +# Update version in sphinx doc files +sed $sedopt "s/${version}/${new_version}/g" docs/eng/users/source/conf.py +sed $sedopt "s/${version}/${new_version}/g" docs/eng/developer/source/conf.py + +# Update installer +sed $sedopt "s/\<property name=\"version\" value=\"${version}\" \/\>/\<property name=\"version\" value=\"${new_version}\" \/\>/g" installer/build.xml + +# Update version pom files +find . -name pom.xml -exec sed $sedopt "s/${version}/${new_version}/g" {} \; \ No newline at end of file Modified: trunk/updateBranchVersions.sh =================================================================== --- trunk/updateBranchVersions.sh 2011-01-13 10:53:39 UTC (rev 7146) +++ trunk/updateBranchVersions.sh 2011-01-13 10:54:16 UTC (rev 7147) @@ -3,16 +3,15 @@ # Usage to update branch from a release 2.6.2 version to 2.6.3-SNAPSHOT version # In root folder of branch code: ./updateBranchVersion.sh 2.6.2 2.6.3 -# Note: In MacOs change seed -i to seed -i .bak to work properly - function showUsage { echo -e "\nThis script is used to update branch from a release version to next SNAPSHOT version. Should be used in branch after creating a new release (tag)." - echo -e "\nUsage:" - echo -e "\t`basename $0 $1` {actual_version} {next_version}" - echo -e "\nExample to update file versions from 2.6.2 to 2.6.3-SNAPSHOT:" - echo -e "\t`basename $0 $1` 2.6.2 2.6.3" - echo -e "\n" + echo + echo -e "Usage: ./`basename $0 $1` actual_version next_version" + echo + echo -e "Example to update file versions from 2.7.0 to 2.7.1-SNAPSHOT:" + echo -e "\t./`basename $0 $1` 2.7.0 2.7.1" + echo } if [ "$1" = "-h" ] @@ -27,16 +26,48 @@ exit fi +if [[ $1 != [0-9].[0-9].[0-9] ]]; then + echo + echo 'Update failed due to incorrect versionnumber format (' $1 ')' + echo 'The format should be three numbers separated by dots. e.g.: 2.7.0' + echo + echo "Usage: ./`basename $0 $1` 2.7.0 2.7.1" + echo + exit +fi + +if [[ $2 != [0-9].[0-9].[0-9] ]]; then + echo + echo 'Update failed due to incorrect new versionnumber format (' $2 ')' + echo 'The format should be three numbers separated by dots. e.g.: 2.7.1' + echo + echo "Usage: ./`basename $0 $1` 2.7.0 2.7.1" + echo + exit +fi + +# Note: In MacOS (darwin10.0) sed requires -i .bak as option to work properly +if [[ $OSTYPE == 'darwin10.0' ]]; then + sedopt='-i .bak' +else + sedopt='-i' +fi + +echo +echo 'Your Operating System is' $OSTYPE +echo 'sed will use the following option: ' $sedopt +echo + version="$1" new_version="$2" # Update version in sphinx doc files -sed -i "s/${version}/${new_version}-SNAPSHOT/g" docs/eng/users/source/conf.py -sed -i "s/${version}/${new_version}-SNAPSHOT/g" docs/eng/developer/source/conf.py +sed $sedopt "s/${version}/${new_version}-SNAPSHOT/g" docs/eng/users/source/conf.py +sed $sedopt "s/${version}/${new_version}-SNAPSHOT/g" docs/eng/developer/source/conf.py # Update installer -sed -i "s/\<property name=\"version\" value=\"${version}\" \/\>/\<property name=\"version\" value=\"${new_version}\" \/\>/g" installer/build.xml -sed -i "s/\<property name=\"subVersion\" value=\"0\" \/\>/\<property name=\"subVersion\" value=\"SNAPSHOT\" \/\>/g" installer/build.xml +sed $sedopt "s/\<property name=\"version\" value=\"${version}\" \/\>/\<property name=\"version\" value=\"${new_version}\" \/\>/g" installer/build.xml +sed $sedopt "s/\<property name=\"subVersion\" value=\"0\" \/\>/\<property name=\"subVersion\" value=\"SNAPSHOT\" \/\>/g" installer/build.xml # Update version pom files -find . -name pom.xml -exec sed -i "s/${version}/${new_version}-SNAPSHOT/g" {} \; \ No newline at end of file +find . -name pom.xml -exec sed $sedopt "s/${version}/${new_version}-SNAPSHOT/g" {} \; \ No newline at end of file Modified: trunk/updateReleaseVersions.sh =================================================================== --- trunk/updateReleaseVersions.sh 2011-01-13 10:53:39 UTC (rev 7146) +++ trunk/updateReleaseVersions.sh 2011-01-13 10:54:16 UTC (rev 7147) @@ -3,16 +3,15 @@ # Usage to create 2.6.2 release version from 2.6.2-SNAPSHOT # In root folder of branch code: ./updateReleaseVersion.sh 2.6.2 -# Note: In MacOs change seed -i to seed -i .bak to work properly - function showUsage { echo -e "\nThis script is used to update branch from a SNAPSHOT version to a release version. Should be used in branch before creating a new release (tag)." - echo -e "\nUsage:" - echo -e "\t`basename $0 $1` {version}" - echo -e "\nExample to update file versions from 2.6.2-SNAPSHOT to 2.6.2:" - echo -e "\t`basename $0 $1` 2.6.2" - echo -e "\n" + echo + echo -e "Usage: `basename $0 $1` version" + echo + echo -e "Example to update file versions from 2.7.0-SNAPSHOT to 2.7.0:" + echo -e "\t`basename $0 $1` 2.7.0" + echo } if [ "$1" = "-h" ] @@ -27,14 +26,36 @@ exit fi +if [[ $1 != [0-9].[0-9].[0-9] ]]; then + echo + echo 'Update failed due to incorrect versionnumber format: ' $1 + echo 'The format should be three numbers separated by dots. e.g.: 2.7.0' + echo + echo "Usage: ./`basename $0 $1` 2.7.0" + echo + exit +fi + +# Note: In MacOS (darwin10.0) sed requires -i .bak as option to work properly +if [[ $OSTYPE == 'darwin10.0' ]]; then + sedopt='-i .bak' +else + sedopt='-i' +fi + +echo +echo 'Your Operating System is' $OSTYPE +echo 'sed will use the following option: ' $sedopt +echo + version="$1" # Update version in sphinx doc files -sed -i "s/${version}-SNAPSHOT/${version}/g" docs/eng/users/source/conf.py -sed -i "s/${version}-SNAPSHOT/${version}/g" docs/eng/developer/source/conf.py +sed $sedopt "s/${version}-SNAPSHOT/${version}/g" docs/eng/users/source/conf.py +sed $sedopt "s/${version}-SNAPSHOT/${version}/g" docs/eng/developer/source/conf.py # Update installer -sed -i "s/\<property name=\"subVersion\" value=\"SNAPSHOT\" \/\>/\<property name=\"subVersion\" value=\"0\" \/\>/g" installer/build.xml +sed $sedopt "s/\<property name=\"subVersion\" value=\"SNAPSHOT\" \/\>/\<property name=\"subVersion\" value=\"0\" \/\>/g" installer/build.xml # Update version pom files -find . -name pom.xml -exec sed -i "s/${version}-SNAPSHOT/${version}/g" {} \; \ No newline at end of file +find . -name pom.xml -exec sed $sedopt "s/${version}-SNAPSHOT/${version}/g" {} \; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |