contrib/release: check NEWS file before release

This commit is contained in:
Thomas Haller 2020-12-06 15:32:50 +01:00
parent cd0e328f7e
commit ae5ea7fa62
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -55,7 +55,7 @@ echo_color() {
print_usage() {
echo "Usage:"
echo " $BASH_SOURCE [devel|rc1|rc|major|major-post|minor] [--no-test] [--no-find-backports] [--no-cleanup] [--allow-local-branches] [--no-check-gitlab]"
echo " $BASH_SOURCE [devel|rc1|rc|major|major-post|minor] [--no-test] [--no-find-backports] [--no-cleanup] [--allow-local-branches] [--no-check-gitlab] [--no-check-news]"
}
die_help() {
@ -156,6 +156,23 @@ set_version_number() {
set_version_number_meson "$@"
}
check_news() {
local mode="$1"
shift
local ver_arr=("$@")
case "$mode" in
major|minor)
if git grep -q 'NOT RECOMMENDED FOR PRODUCTION USE' -- ./NEWS ; then
return 1
fi
;;
*)
;;
esac
return 0
}
DO_CLEANUP=1
CLEANUP_CHECKOUT_BRANCH=
CLEANUP_REFS=()
@ -186,6 +203,7 @@ FIND_BACKPORTS=1
ALLOW_LOCAL_BRANCHES=0
HELP_AND_EXIT=1
CHECK_GITLAB=1
CHECK_NEWS=1
while [ "$#" -ge 1 ]; do
A="$1"
shift
@ -209,6 +227,9 @@ while [ "$#" -ge 1 ]; do
--no-check-gitlab)
CHECK_GITLAB=0
;;
--no-check-news)
CHECK_NEWS=0
;;
--help|-h)
die_help
;;
@ -337,6 +358,13 @@ if [ "$ALLOW_LOCAL_BRANCHES" != 1 ]; then
cmp <(git show origin/master:contrib/fedora/rpm/release.sh) "$BASH_SOURCE" || die "$BASH_SOURCE is not identical to \`git show origin/master:contrib/fedora/rpm/release.sh\`"
fi
if ! check_news "$RELEASE_MODE" "@{VERSION_ARR[@]}" ; then
if [ "$CHECK_NEWS" == 1 ]; then
die "NEWS file needs update to mention stable release (skip check with --no-check-news)"
fi
echo "WARNING: NEWS file needs update to mention stable release (test skipped with --no-check-news)"
fi
if [ $FIND_BACKPORTS = 1 ]; then
git show "$ORIGIN/master:contrib/scripts/find-backports" > ./.git/nm-find-backports \
&& chmod +x ./.git/nm-find-backports \