prepare the tag script for the new release
This commit is contained in:
parent
20ac9757ba
commit
985fad9e32
|
@ -37,6 +37,11 @@ parse_version () {
|
||||||
micro="0"
|
micro="0"
|
||||||
ver="${major}.${minor}${rev}"
|
ver="${major}.${minor}${rev}"
|
||||||
fi
|
fi
|
||||||
|
gver="$(echo "$ver" | sed -e 's/[~_]/-/')"
|
||||||
|
grev="$(echo "$rev" | sed -e 's/[~_]/-/')"
|
||||||
|
gmajor="$major"
|
||||||
|
gminor="$minor"
|
||||||
|
gmicro="$micro"
|
||||||
[ -n "$crev" ] && cver="${cver}.${crev}"
|
[ -n "$crev" ] && cver="${cver}.${crev}"
|
||||||
echo "ver='$ver'"
|
echo "ver='$ver'"
|
||||||
echo "major='$major'"
|
echo "major='$major'"
|
||||||
|
@ -48,6 +53,11 @@ parse_version () {
|
||||||
echo "cminor='$cminor'"
|
echo "cminor='$cminor'"
|
||||||
echo "cmicro='$cmicro'"
|
echo "cmicro='$cmicro'"
|
||||||
echo "crev='$crev'"
|
echo "crev='$crev'"
|
||||||
|
echo "gver='$gver'"
|
||||||
|
echo "gmajor='$gmajor'"
|
||||||
|
echo "gminor='$gminor'"
|
||||||
|
echo "gmicro='$gmicro'"
|
||||||
|
echo "grev='$grev'"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_fs_ver () {
|
set_fs_ver () {
|
||||||
|
|
|
@ -2,20 +2,38 @@
|
||||||
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
||||||
##### release a version of FreeSWITCH
|
##### release a version of FreeSWITCH
|
||||||
|
|
||||||
src_repo="$(pwd)"
|
sdir="."
|
||||||
|
[ -n "${0%/*}" ] && sdir="${0%/*}"
|
||||||
|
. $sdir/ci/common.sh
|
||||||
|
|
||||||
if [ ! -d .git ]; then
|
check_pwd
|
||||||
echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
showusage() {
|
showusage() {
|
||||||
echo "usage: ./scripts/tagscript.sh [-s] MAJOR.MINOR.MICRO[.REVISION]" 1>&2
|
cat >&2 <<EOF
|
||||||
|
usage: $0 [-s] <version>
|
||||||
|
|
||||||
|
where <version> follows the format:
|
||||||
|
|
||||||
|
1.2-alpha3
|
||||||
|
1.2-beta3
|
||||||
|
1.2-rc3
|
||||||
|
1.2
|
||||||
|
1.2.13-rc4
|
||||||
|
1.2.13
|
||||||
|
etc.
|
||||||
|
|
||||||
|
I'll take care of correctly naming the tag to be consistent with
|
||||||
|
FreeSWITCH git policy from there.
|
||||||
|
|
||||||
|
EOF
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "s" o; do
|
opts=""
|
||||||
|
debug=false
|
||||||
|
while getopts "ds" o; do
|
||||||
case "$o" in
|
case "$o" in
|
||||||
|
d) debug=true ;;
|
||||||
s) opts="-s" ;;
|
s) opts="-s" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -25,67 +43,74 @@ if [ -z "$1" ]; then
|
||||||
showusage
|
showusage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ver="$1"
|
eval $(parse_version "$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"
|
ngrep () { grep -e "$1" >/dev/null; }
|
||||||
dst_dir="$src_repo/../$dst_name"
|
|
||||||
|
|
||||||
if [ -d "$dst_dir" ]; then
|
if ! $debug && ! (echo "$opts" | ngrep '-s'); then
|
||||||
echo "error: destination directory $dst_dir already exists." 1>&2
|
cat >&2 <<EOF
|
||||||
exit 1;
|
You've asked me to tag a release but haven't asked to me sign it by
|
||||||
|
passing -s. I'll do this if you really want, but it's a bad idea if
|
||||||
|
you're making an actual release of FreeSWITCH that'll be seen
|
||||||
|
publicly.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
while true; do
|
||||||
|
echo -n "Is this just a test tag? (yes/no): " >&2
|
||||||
|
read r
|
||||||
|
[ -z "$r" ] && continue
|
||||||
|
if [ "$r" = yes ] || [ "$r" = y ]; then
|
||||||
|
(echo; echo "OK, I believe you."; echo) >&2
|
||||||
|
break
|
||||||
|
else
|
||||||
|
(echo; echo "This is a bad idea then."; echo) >&2
|
||||||
|
fi
|
||||||
|
while true; do
|
||||||
|
echo -n "Are you really really sure? (yes/no): " >&2
|
||||||
|
read r
|
||||||
|
[ -z "$r" ] && continue
|
||||||
|
if [ "$r" = yes ] || [ "$r" = y ]; then
|
||||||
|
(echo; echo "As you wish, you've been warned."; echo) >&2
|
||||||
|
break
|
||||||
|
else
|
||||||
|
(echo; echo "Great; go setup a GPG key and try again with -s"; echo) >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
done
|
||||||
|
break
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# save local changes
|
echo "Saving uncommitted changes before tagging..." >&2
|
||||||
ret=$(git stash save "Save uncommitted changes before tagging.")
|
ret=$(git stash save "Save uncommitted changes before tagging.")
|
||||||
if echo $ret | grep "^Saved"; then
|
if (echo "$ret" | ngrep '^Saved'); then
|
||||||
stash_saved=1
|
stash_saved=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
|
echo "Changing the version of configure.in..." >&2
|
||||||
-e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
|
set_fs_ver "$gver" "$gmajor" "$gminor" "$gmicro" "$grev"
|
||||||
-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
|
|
||||||
|
|
||||||
if [ -n "$rev" ]; then
|
|
||||||
sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
|
|
||||||
-e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
|
|
||||||
-i configure.in
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
echo "Committing the new version..." >&2
|
||||||
git add configure.in
|
git add configure.in
|
||||||
git commit -m "Release freeswitch-$ver"
|
git commit -m "Release freeswitch-$gver"
|
||||||
git tag -a ${opts} -m "freeswitch-$ver release" v$ver
|
echo "Tagging freeswitch v$gver..." >&2
|
||||||
|
git tag -a ${opts} -m "freeswitch-$gver release" "v$gver"
|
||||||
|
|
||||||
git clone $src_repo $dst_dir
|
|
||||||
if [ -n "$stash_saved" ]; then
|
if [ -n "$stash_saved" ]; then
|
||||||
git stash pop
|
echo "Restoring your uncommitted changes to your working directory..." >&2
|
||||||
|
git stash pop >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $dst_dir
|
|
||||||
|
|
||||||
./bootstrap.sh
|
|
||||||
mv bootstrap.sh rebootstrap.sh
|
|
||||||
rm -f docs/AUTHORS
|
|
||||||
rm -f docs/COPYING
|
|
||||||
rm -f docs/ChangeLog
|
|
||||||
rm -rf .git
|
|
||||||
cd ..
|
|
||||||
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
|
|
||||||
|
|
||||||
cat 1>&2 <<EOF
|
cat 1>&2 <<EOF
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
The v$ver tag has been committed locally, but it will not be
|
The v$gver tag has been committed locally, but it will not be
|
||||||
globally visible until you 'git push --tags' this repository up to the
|
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).
|
server (I didn't do that for you, as you might want to review first).
|
||||||
|
|
||||||
|
Next step:
|
||||||
|
|
||||||
|
git push --tags
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue