1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
#!/bin/sh
#
# SPDX-FileCopyrightText: 2023-2025 Sébastien Helleu <flashcode@flashtux.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
#
#
# Make a new WeeChat release:
# 1. bump version
# 2. git commit + tag
# 3. compile, run, test, build packages
# 4. test package: unpack, compile, run, test
#
set -o errexit
release_error ()
{
[ $# -gt 0 ] && echo >&2 "ERROR: $*"
exit 1
}
release_start ()
{
root_dir="$(git rev-parse --show-toplevel)"
if [ -n "$(git status --porcelain)" ]; then
release_error "working directory not clean"
fi
version=$("${root_dir}/version.sh" devel)
if git rev-parse "v${version}" 2>/dev/null; then
release_error "tag v${version} already exists"
fi
msg=$(git log -1 --pretty=%B | tr -d "\n")
if [ "${msg}" = "Version ${version}" ]; then
release_error "commit for version already exists"
fi
date=$(date +"%Y-%m-%d")
build_dir="${root_dir}/release/${version}"
if [ -d "${build_dir}" ]; then
release_error "directory ${build_dir} already exists"
fi
mkdir -p "${build_dir}"
pkg_tar="${build_dir}/weechat-${version}.tar"
}
release_bump_version ()
{
"${root_dir}/tools/bump_version.sh" stable
sed -i \
-e "s/^\(## Version ${version}\) (under dev)$/\1 (${date})/" \
"${root_dir}/CHANGELOG.md"
}
release_commit_tag ()
{
cd "${root_dir}"
git commit -m "Version ${version}" version.sh CHANGELOG.md || release_error "git commit error, release already done?"
git tag -a "v${version}" -m "WeeChat ${version}"
}
release_build ()
{
cd "${build_dir}"
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${build_dir}/install" \
-DWEECHAT_HOME="${build_dir}/home" \
-DENABLE_DOC=ON \
-DENABLE_MAN=ON \
-DENABLE_TESTS=ON \
"${root_dir}"
make install
make test CTEST_OUTPUT_ON_FAILURE=TRUE
make dist
version_weechat=$("${build_dir}/install/bin/weechat" --version)
if [ "${version_weechat}" != "${version}" ]; then
release_error "unexpected version \"${version_weechat}\" (expected: \"${version}\")"
fi
}
release_test_pkg ()
{
cd "${build_dir}"
tar axvf "weechat-${version}.tar.xz"
cd "weechat-${version}"
pkg_dir="$(pwd)"
script_version="${pkg_dir}/version.sh"
[ "$("${script_version}" stable)" = "${version}" ] || release_error "wrong stable version in ${script_version}"
[ "$("${script_version}" devel)" = "${version}" ] || release_error "wrong devel version in ${script_version}"
[ "$("${script_version}" devel-full)" = "${version}" ] || release_error "wrong devel-full version in ${script_version}"
mkdir build
cd build
pkg_build_dir="$(pwd)"
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${pkg_build_dir}/install" \
-DWEECHAT_HOME="${pkg_build_dir}/home" \
-DENABLE_DOC=ON \
-DENABLE_MAN=ON \
-DENABLE_TESTS=ON \
"${pkg_dir}"
make install
make test CTEST_OUTPUT_ON_FAILURE=TRUE
version_weechat=$("${pkg_build_dir}/install/bin/weechat" --version)
if [ "${version_weechat}" != "${version}" ]; then
release_error "unexpected version \"${version_weechat}\" (expected: \"${version}\")"
fi
}
release_end ()
{
# display a report about the release made
echo
echo "========================= WeeChat release status ========================="
echo " version : ${version}"
echo " date : ${date}"
echo " build dir: ${build_dir}"
echo " packages :"
for pkg in "${pkg_tar}".*; do
echo " $pkg"
done
echo "=========================================================================="
echo
echo "*** SUCCESS! ***"
echo
}
release_start
release_bump_version
release_commit_tag
release_build
release_test_pkg
release_end
exit 0
|