1
0
forked from bip/bip
bip/scripts/bip-release

63 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/sh
set -e
if [ ! -d src ] ; then
echo "Please run me in bip sources root." >&2
exit 1
fi
release="$1"
: ${MAKEOPTS:=-j -l4}
set_version() {
local release
release="${1}"
sed -i -e '/^AC_INIT/s/\(, \[\)[^]]*/\1'${release}'/' configure.ac
}
get_version() {
grep -e '^AC_INIT' configure.ac | cut -d [ -f 3 | cut -d ] -f 1
}
make_distcheck() {
if ! make ${MAKEOPTS} distcheck; then
echo "'make distcheck' fails, please try again." >&2
return 1
else
true
fi
}
git log > ChangeLog
if [ -n "$release" ]; then
set_version "${release}"
make_distcheck || exit 1
git commit -a -m "Update version and ChangeLog for bip-${release} release."
git tag release-$release
set_version "${release}-git"
git commit -a -m "Add -git to version string."
echo "See bip-${release}.tar.gz"
else
make_distcheck || exit 1
tarname=bip-$(get_version)
prefix=bip-$(date +%y%m%d)
rm -rf "${tarname}" "${prefix}"
tar -xzf "${tarname}".tar.gz
rm -rf "${tarname}".tar.gz
2008-01-09 20:18:27 +01:00
mv "${tarname}" "${prefix}"
tar -czf "${prefix}".tar.gz "${prefix}"
rm -rf "${prefix}"
# Revert the ChangeLog.
git checkout HEAD -- ChangeLog
echo "See ${prefix}.tar.gz"
fi