slackbuilds/bin/mk_rel.bash
2010-07-10 12:41:05 +01:00

54 lines
846 B
Bash
Executable file

#!/usr/bin/env bash
set -e
function configure_ac_ver_ok {
cat configure.ac | grep "${1}" || return 1
}
function magit_el_ver_ok {
grep -e ";; Version: *$1" magit.el || return 1
}
USAGE="usage: ${0##*/} <tag>"
tag="${1}"
[ ${#} -lt 1 ] && {
echo ${USAGE} >&2
exit 2
}
# does the specified tag exist?
if ! git tag | grep "${tag}"; then
echo "Make sure you've tagged '${tag}'"
exit 3
fi
# grab that tag
git co "${tag}"
# correct version in magit?
if ! magit_el_ver_ok "$tag"; then
echo "Please set version in magit.el to $tag"
git co master
exit 1
fi
# correct version in configure.ac?
if ! configure_ac_ver_ok "$tag"; then
echo "Please set AC_INIT to $tag in configure.ac"
git co master
exit 1
fi
# clean up if we need to
[ -f Makefile ] && make distclean
./autogen.sh
./configure
make dist
git co master