2008-01-09 20:17:38 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ ! -d src ] ; then
|
|
|
|
echo "Please run me in bip sources root." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-10-19 14:57:15 +02:00
|
|
|
release_version="$1"
|
|
|
|
release_name="$2"
|
2011-09-13 04:55:17 +02:00
|
|
|
: ${MAKEOPTS:=-j -l4}
|
2008-01-09 20:17:38 +01:00
|
|
|
|
2011-09-13 04:55:17 +02:00
|
|
|
set_version() {
|
2013-10-19 14:57:15 +02:00
|
|
|
local release_version
|
|
|
|
release_version="${1}"
|
2020-05-18 04:43:59 +02:00
|
|
|
sed -i -e '/^AC_INIT/s/\(,\[\)[^]]*/\1'${release_version}'/' configure.ac
|
2011-09-13 04:55:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
get_version() {
|
|
|
|
grep -e '^AC_INIT' configure.ac | cut -d [ -f 3 | cut -d ] -f 1
|
|
|
|
}
|
|
|
|
|
|
|
|
make_distcheck() {
|
2013-10-19 13:28:42 +02:00
|
|
|
# prepare sources
|
|
|
|
autoreconf -i -Wall
|
|
|
|
# Create makefile, use all possible options
|
2018-12-10 00:17:14 +01:00
|
|
|
./configure
|
2013-10-19 13:28:42 +02:00
|
|
|
# run distcheck
|
2011-09-13 04:55:17 +02:00
|
|
|
if ! make ${MAKEOPTS} distcheck; then
|
|
|
|
echo "'make distcheck' fails, please try again." >&2
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
true
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
git log > ChangeLog
|
2013-10-19 14:57:15 +02:00
|
|
|
if [ -n "$release_version" ]; then
|
|
|
|
set_version "${release_version}"
|
2011-09-13 04:55:17 +02:00
|
|
|
make_distcheck || exit 1
|
|
|
|
|
2017-07-26 03:41:10 +02:00
|
|
|
git commit -a --gpg-sign -m "Update version and ChangeLog for bip-${release_version} release."
|
2013-10-19 14:57:15 +02:00
|
|
|
TAG_COMMENT="Release ${release_version}"
|
|
|
|
if [ -n "${release_name}" ]; then
|
|
|
|
TAG_COMMENT="${TAG_COMMENT} '${release_name}'"
|
|
|
|
fi
|
2017-07-26 03:41:10 +02:00
|
|
|
git tag --sign -m "${TAG_COMMENT}" release-${release_version}
|
2011-09-13 04:55:17 +02:00
|
|
|
|
2013-10-19 14:57:15 +02:00
|
|
|
set_version "${release_version}-git"
|
2017-07-26 03:41:10 +02:00
|
|
|
git commit -a --gpg-sign -m "Add -git to version string."
|
2011-09-13 04:55:17 +02:00
|
|
|
|
2013-10-19 14:57:15 +02:00
|
|
|
echo "See bip-${release_version}.tar.gz"
|
2008-01-09 20:17:38 +01:00
|
|
|
else
|
2011-09-13 04:55:17 +02:00
|
|
|
make_distcheck || exit 1
|
|
|
|
|
|
|
|
tarname=bip-$(get_version)
|
2013-10-19 13:34:15 +02:00
|
|
|
prefix=bip-$(date +%Y%m%d)
|
2008-01-09 20:17:38 +01:00
|
|
|
|
2011-09-13 04:55:17 +02:00
|
|
|
rm -rf "${tarname}" "${prefix}"
|
|
|
|
tar -xzf "${tarname}".tar.gz
|
|
|
|
rm -rf "${tarname}".tar.gz
|
2008-01-09 20:18:27 +01:00
|
|
|
|
2011-09-13 04:55:17 +02: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
|
2013-10-19 13:28:42 +02:00
|
|
|
|
|
|
|
# cleanup
|
|
|
|
git clean -d -i -e "bip-*.tar.gz"
|
|
|
|
|