2010-03-30 18:00:04 +00:00
|
|
|
#!/bin/bash
|
2012-05-07 20:52:50 +00:00
|
|
|
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
|
|
|
##### release a version of FreeSWITCH
|
2010-03-30 18:00:04 +00:00
|
|
|
|
|
|
|
src_repo="$(pwd)"
|
|
|
|
|
|
|
|
if [ ! -d .git ]; then
|
2012-05-07 20:52:50 +00:00
|
|
|
echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
|
|
|
|
exit 1;
|
2010-03-30 18:00:04 +00:00
|
|
|
fi
|
|
|
|
|
2011-09-24 06:24:49 +00:00
|
|
|
showusage() {
|
2012-05-07 20:52:50 +00:00
|
|
|
echo "usage: ./scripts/tagscript.sh [-s] MAJOR.MINOR.MICRO[.REVISION]" 1>&2
|
|
|
|
exit 1;
|
2011-09-24 06:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while getopts "s" o; do
|
2012-05-07 20:52:50 +00:00
|
|
|
case "$o" in
|
|
|
|
s) opts="-s" ;;
|
|
|
|
esac
|
2011-09-24 06:24:49 +00:00
|
|
|
done
|
|
|
|
shift $(($OPTIND-1))
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
2012-05-07 20:52:50 +00:00
|
|
|
showusage
|
2010-03-30 18:00:04 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
ver="$1"
|
|
|
|
major=$(echo "$ver" | cut -d. -f1)
|
|
|
|
minor=$(echo "$ver" | cut -d. -f2)
|
|
|
|
micro=$(echo "$ver" | cut -d. -f3)
|
|
|
|
rev=$(echo "$ver" | cut -d. -f4)
|
|
|
|
|
|
|
|
dst_name="freeswitch-$major.$minor.$micro"
|
|
|
|
dst_dir="$src_repo/../$dst_name"
|
|
|
|
|
|
|
|
if [ -d "$dst_dir" ]; then
|
2012-05-07 20:52:50 +00:00
|
|
|
echo "error: destination directory $dst_dir already exists." 1>&2
|
|
|
|
exit 1;
|
2010-03-30 18:00:04 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# save local changes
|
|
|
|
ret=$(git stash save "Save uncommitted changes before tagging.")
|
|
|
|
if echo $ret | grep "^Saved"; then
|
2012-05-07 20:52:50 +00:00
|
|
|
stash_saved=1
|
2010-03-30 18:00:04 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
|
2012-05-07 20:52:50 +00:00
|
|
|
-e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
|
|
|
|
-e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \
|
|
|
|
-e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \
|
|
|
|
-i configure.in
|
2010-03-30 18:00:04 +00:00
|
|
|
|
|
|
|
if [ -n "$rev" ]; then
|
2012-05-07 20:52:50 +00:00
|
|
|
sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
|
|
|
|
-e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
|
|
|
|
-i configure.in
|
2010-03-30 18:00:04 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
git add configure.in
|
|
|
|
git commit -m "Release freeswitch-$ver"
|
2011-09-24 06:24:49 +00:00
|
|
|
git tag -a ${opts} -m "freeswitch-$ver release" v$ver
|
2010-03-30 18:00:04 +00:00
|
|
|
|
|
|
|
git clone $src_repo $dst_dir
|
|
|
|
if [ -n "$stash_saved" ]; then
|
2012-05-07 20:52:50 +00:00
|
|
|
git stash pop
|
2010-03-30 18:00:04 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd $dst_dir
|
|
|
|
|
2009-03-30 22:17:26 +00:00
|
|
|
./bootstrap.sh
|
2009-08-01 06:31:54 +00:00
|
|
|
mv bootstrap.sh rebootstrap.sh
|
2009-03-30 22:17:26 +00:00
|
|
|
rm -f docs/AUTHORS
|
|
|
|
rm -f docs/COPYING
|
|
|
|
rm -f docs/ChangeLog
|
2010-03-30 18:00:04 +00:00
|
|
|
rm -rf .git
|
2009-03-30 22:17:26 +00:00
|
|
|
cd ..
|
2010-04-02 16:13:43 +00:00
|
|
|
tar -cvf $dst_name.tar $dst_dir
|
|
|
|
gzip -9 -c $dst_name.tar > $dst_name.tar.gz || echo "gzip not available"
|
|
|
|
bzip2 -z -k $dst_name.tar || echo "bzip2 not available"
|
|
|
|
xz -z -9 -k $dst_name.tar || echo "xz / xz-utils not available"
|
|
|
|
rm -rf $dst_name.tar $dst_dir
|
2010-03-30 18:00:04 +00:00
|
|
|
|
2010-03-30 18:52:40 +00:00
|
|
|
cat 1>&2 <<EOF
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
The v$ver tag has been committed locally, but it will not be
|
2010-04-01 21:23:56 +00:00
|
|
|
globally visible until you 'git push --tags' this repository up to the
|
|
|
|
server (I didn't do that for you, as you might want to review first).
|
2010-03-30 18:52:40 +00:00
|
|
|
----------------------------------------------------------------------
|
|
|
|
EOF
|
|
|
|
|
2012-05-07 20:52:50 +00:00
|
|
|
exit 0
|