From: Thomas Berezansky Date: Thu, 19 May 2011 18:18:08 +0000 (-0400) Subject: First attempt at version application script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=defbb633756bad36ab57f50ae976ed4162e1f30f;p=working%2FEvergreen.git First attempt at version application script Usage: Create/Checkout new branch AKA, #.#-beta# or #.#.# Run build/tools/apply_version.sh git commit -as to save changes. Can be told what version to use instead via first command line option. Uses current branch name for "HeadURL" and auto-version checks. Signed-off-by: Thomas Berezansky --- diff --git a/build/tools/apply_version.sh b/build/tools/apply_version.sh new file mode 100755 index 0000000000..91731a9fd9 --- /dev/null +++ b/build/tools/apply_version.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +GIT_ABS=`git rev-parse --show-toplevel` +GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` +HEADURL="http://git.evergreen-ils.org/Evergreen.git?h=refs/heads/$GIT_BRANCH" + +VERSION=${1:-AUTO} + +if [ $VERSION = "AUTO" ]; then + # Auto-pick version based on branch name + echo AUTO VERSION + VERSION=`echo $GIT_BRANCH | sed 's/^rel_\([0-9]\+\)_\([0-9]\+\)_\([0-9]\+\)$/\1.\2.\3/'` + VERSION=`echo $VERSION | sed 's/^rel_\([0-9]\+\)_\([0-9]\+\)_\(.\+\)$/\1.\2-\3/'` + if [ "$VERSION" = "$GIT_BRANCH" ]; then + echo "AUTO VERSION FAILED." + exit 1 + fi +fi +SHORT_VERSION=`echo $VERSION | grep -o '^[0-9]\+\.[0-9]\+'` +echo "Version: $VERSION Short: $SHORT_VERSION" + +# prep a couple alternate represenations +DASH_VERSION=`echo $VERSION | sed 's/\./-/g'` +UNDER_VERSION=`echo $VERSION | sed -e 's/\./_/g' -e 's/-/_/g'` + +echo "Applying to Application.pm - HEAD -> $DASH_VERSION" +sed -i "s/HEAD/$DASH_VERSION/" $GIT_ABS/Open-ILS/src/perlmods/lib/OpenILS/Application.pm + +echo "Applying to windowssetup.nsi - Master -> $SHORT_VERSION" +sed -i "s/Master/$SHORT_VERSION/" $GIT_ABS/Open-ILS/xul/staff_client/windowssetup.nsi + +echo "Applying to README:" +echo "Header with $VERSION" +echo "STAMP_ID with $UNDER_VERSION" +sed -i -e "1 s/Evergreen.*/Evergreen $VERSION/" -e "s/STAMP_ID=rel_[^ ]*/STAMP_ID=rel_$UNDER_VERSION/" $GIT_ABS/README + +echo "Applying \$HeadURL\$ - $HEADURL" +for file in `grep -Rl '\\$HeadURL\\$' $GIT_ABS`; +do + echo $file + sed -i "s|\\\$HeadURL\\\$|$HEADURL|" $file +done