More fun - Support running on short then long
authorThomas Berezansky <tsbere@mvlc.org>
Thu, 19 May 2011 18:57:45 +0000 (14:57 -0400)
committerThomas Berezansky <tsbere@mvlc.org>
Thu, 19 May 2011 19:06:05 +0000 (15:06 -0400)
AKA, rel_2_2 then later rel_2_2_1

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
build/tools/apply_version.sh

index 91731a9..74dd075 100755 (executable)
@@ -2,7 +2,8 @@
 
 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"
+HEADURLBASE="http://git.evergreen-ils.org/Evergreen.git?h=refs/heads/"
+HEADURL="$HEADURLBASE$GIT_BRANCH"
 
 VERSION=${1:-AUTO}
 
@@ -21,10 +22,12 @@ echo "Version: $VERSION Short: $SHORT_VERSION"
 
 # prep a couple alternate represenations
 DASH_VERSION=`echo $VERSION | sed 's/\./-/g'`
+SHORT_DASH_VERSION=`echo $SHORT_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 "Alt: $SHORT_DASH_VERSION -> $DASH_VERSION"
+sed -i -e "s/HEAD/$DASH_VERSION/" -e "s/$SHORT_DASH_VERSION/$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
@@ -34,8 +37,16 @@ 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 "Finding/updating old \$HeadURL\$ entries"
+HEADURLBASE=`echo ${HEADURLBASE} | sed 's/\?/\\?/'`
+for file in `grep -Rl --exclude=apply_version.sh "$HEADURLBASE" $GIT_ABS`
+do
+    echo $file
+    sed -i "s|${HEADURLBASE}[A-Za-z0-9_]*|$HEADURL|" $file
+done
+
 echo "Applying \$HeadURL\$ - $HEADURL"
-for file in `grep -Rl '\\$HeadURL\\$' $GIT_ABS`;
+for file in `grep -Rl --exclude=apply_version.sh '\\$HeadURL\\$' $GIT_ABS`
 do
     echo $file
     sed -i "s|\\\$HeadURL\\\$|$HEADURL|" $file