Rewrote the release tagging script so as to work usefully with git.

This commit is contained in:
Travis Cross 2010-03-30 18:00:04 +00:00
parent 3c0cb60fa2
commit 54e48da7be

View File

@ -1,34 +1,67 @@
NEW_MICRO=4 #!/bin/bash
rm -rf freeswitch.tag.working
svn co http://svn.freeswitch.org/svn/freeswitch/trunk freeswitch.tag.working src_repo="$(pwd)"
cd freeswitch.tag.working
SWITCH_VERSION_MAJOR=`grep SWITCH_VERSION_MAJOR configure.in | sed "s|.*\[||" | sed "s|\].*||"` if [ ! -d .git ]; then
SWITCH_VERSION_MINOR=`grep SWITCH_VERSION_MINOR configure.in | sed "s|.*\[||" | sed "s|\].*||"` echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
SWITCH_VERSION_MICRO=`grep SWITCH_VERSION_MICRO configure.in | sed "s|.*\[||" | sed "s|\].*||"` exit 1;
FREESWITCH_VERSION=$((`svnversion .` + 1)) fi
cat configure.in | sed "s|$SWITCH_VERSION_MICRO|$NEW_MICRO|" | sed "s|svn-revision-here|$FREESWITCH_VERSION|" | sed "s|#AC_SUBST(SWITCH_VERSION_REVISION|AC_SUBST(SWITCH_VERSION_REVISION|" > configure.tmp
cp -f configure.tmp configure.in if [ -z "$1" ]; then
rm -f configure.tmp echo "usage: ./scripts/tagscript.sh MAJOR.MINOR.MICRO[.REVISION]" 1>&2
cd libs/openzap/ exit 1;
OPENZAP_VERSION=$((`svnversion .` + 1)) fi
svn copy . http://svn.openzap.org:81/svn/openzap/tags/v$OPENZAP_VERSION -m"tag"
cd ../.. ver="$1"
echo 'cat $1 | sed "s|openzap/trunk|openzap/tags/v'$OPENZAP_VERSION'|" > svn-temp-working' > externaleditor.sh major=$(echo "$ver" | cut -d. -f1)
echo 'cp -f svn-temp-working $1' >> externaleditor.sh minor=$(echo "$ver" | cut -d. -f2)
echo 'rm -f svn-temp-working' >> externaleditor.sh micro=$(echo "$ver" | cut -d. -f3)
chmod a+x externaleditor.sh rev=$(echo "$ver" | cut -d. -f4)
svn propedit svn:externals . --editor-cmd=./externaleditor.sh
svn copy . http://svn.freeswitch.org/svn/freeswitch/tags/$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO -m"tag" dst_name="freeswitch-$major.$minor.$micro"
cd .. dst_dir="$src_repo/../$dst_name"
rm -rf freeswitch.tag.working
svn co http://svn.freeswitch.org/svn/freeswitch/tags/$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO if [ -d "$dst_dir" ]; then
cd freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO echo "error: destination directory $dst_dir already exists." 1>&2
exit 1;
fi
# save local changes
ret=$(git stash save "Save uncommitted changes before tagging.")
if echo $ret | grep "^Saved"; then
stash_saved=1
fi
sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
-i configure.in
if [ -n "$rev" ]; then
sed -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
-i configure.in
fi
git add configure.in
git commit -m "Release freeswitch-$ver"
git tag -a -m "freeswitch-$ver release" v$ver
git clone $src_repo $dst_dir
if [ -n "$stash_saved" ]; then
git stash pop
fi
cd $dst_dir
./bootstrap.sh ./bootstrap.sh
rm -rf `find . -name .svn`
mv bootstrap.sh rebootstrap.sh mv bootstrap.sh rebootstrap.sh
rm -f docs/AUTHORS rm -f docs/AUTHORS
rm -f docs/COPYING rm -f docs/COPYING
rm -f docs/ChangeLog rm -f docs/ChangeLog
rm -rf .git
cd .. cd ..
tar -czvf freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO.tar.gz freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO/ tar -czvf $dst_name.tar.gz $dst_dir
tar -cjvf freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO.tar.bz2 freeswitch-$SWITCH_VERSION_MAJOR.$SWITCH_VERSION_MINOR.$NEW_MICRO/ tar -cjvf $dst_name.tar.bz2 $dst_dir
rm -rf $dst_dir