2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 01:49:48 +00:00

[#3867] Hammer: Pin Meson version to 1.8.1

This commit is contained in:
Andrei Pavel 2025-06-02 16:01:09 +03:00
parent 2e66702e1b
commit 7538e92655
No known key found for this signature in database
GPG Key ID: D4E804481939CB21
3 changed files with 26 additions and 37 deletions

View File

@ -107,21 +107,6 @@ operating system, without the build:
This way, a system can be prepared for our own use.
.. note::
Currently, when this command is run, the latest version of Meson is installed.
This is because, at the time of writing, three different bugs that affect
building Kea with Meson in different processes were fixed in the latest
version, but not in any released version as of yet:
- https://github.com/mesonbuild/meson/issues/11322
- https://github.com/mesonbuild/meson/issues/14412
- https://github.com/mesonbuild/meson/issues/14470
Maintenance Meson release 1.7.2 contains two of the fixes, but arguably, not
the most impactful of them. When Meson 1.8.0 is released, Hammer will bind to
that version.
To prepare such a system using SSH, invoke:
.. code-block:: console

View File

@ -476,6 +476,8 @@ def install_meson(python_v: str = 'python3', mode: str = 'pyinstaller'):
:type mode: str
"""
meson_version = '1.8.1'
exit_code = execute('meson --version', quiet=True, raise_error=False)
if exit_code == 0:
return
@ -485,10 +487,7 @@ def install_meson(python_v: str = 'python3', mode: str = 'pyinstaller'):
execute('sudo /usr/local/share/.venv/bin/pip install ninja')
if mode == 'pyinstaller':
execute('git clone https://github.com/mesonbuild/meson .meson-src')
# TODO: always checkout when 1.8.0 gets released.
_, output = execute('git tag -l', cwd='.meson-src', capture=True, quiet=True)
if '1.8.0' in output.splitlines():
execute('git checkout 1.8.0', cwd='.meson-src')
execute(f'git checkout {meson_version}', cwd='.meson-src')
execute('sudo /usr/local/share/.venv/bin/pip install pyinstaller')
execute('sudo /usr/local/share/.venv/bin/pyinstaller --additional-hooks-dir=packaging --clean '
'--dist ../.meson --onefile ./meson.py',
@ -497,9 +496,7 @@ def install_meson(python_v: str = 'python3', mode: str = 'pyinstaller'):
execute('sudo cp /usr/local/share/.venv/bin/ninja /usr/local/bin')
elif mode == 'venv':
# TODO: change to this when 1.8.0 gets released.
# execute('/usr/local/share/.venv/bin/pip install meson==1.8.0')
execute('sudo /usr/local/share/.venv/bin/pip install git+https://github.com/mesonbuild/meson.git')
execute(f'sudo /usr/local/share/.venv/bin/pip install meson=={meson_version}')
execute('sudo ln -s /usr/local/share/.venv/bin/meson /usr/local/bin/meson')
execute('sudo ln -s /usr/local/share/.venv/bin/ninja /usr/local/bin/ninja')
else:

View File

@ -8,6 +8,8 @@
set -eu
meson_version=1.8.1
# Check if ${1} <= ${2}.
le() {
# Sort numerically and check the first item.
@ -27,17 +29,19 @@ print_usage() {
'Usage: %s {{options}}
Options:
[-i|--install] install meson and ninja to gobal scope. attempts to acquire root privileges
[-p|--venv] use venv instead of pyinstaller
[-l|--latest] use latest meson instead of %s
[-v|--venv] use venv instead of pyinstaller
[-h|--help] print usage (this text)
' \
"$(basename "${0}")"
"$(basename "${0}")" "${meson_version}"
}
# Parse parameters.
while test ${#} -gt 0; do
case "${1}" in
'-i'|'--install') install=true ;;
'-p'|'--venv') use_venv=true ;;
'-l'|'--latest') latest=true ;;
'-v'|'--venv') use_venv=true ;;
'-h'|'--help') print_usage; exit 0 ;;
*) break ;;
esac; shift
@ -45,6 +49,7 @@ done
# Default parameters
test -z "${install+x}" && install=false
test -z "${latest+x}" && latest=false
test -z "${use_venv+x}" && use_venv=false
if "${install}" && "${use_venv}"; then
@ -59,8 +64,8 @@ fi
top_level=$(cd "$(dirname "${0}")" && pwd)
cd "${top_level}" || exit 1
if command -v meson > /dev/null 2>&1 && le 1.8.0 "$(meson --version)"; then
# Good to be used. Does not suffer from endless transitional dependency iteration.
if command -v meson > /dev/null 2>&1 && ! "${latest}" && le "${meson_version}" "$(meson --version)"; then
# Good to be used. Does not suffer from endless transitional dependency iteration fixed in 1.8.0.
meson='meson'
else
meson='.meson/meson'
@ -90,21 +95,22 @@ else
${sudo} cp "${venv}/bin/ninja" .meson/ninja
if "${use_venv}"; then
# TODO: change to this when 1.8.0 gets released.
# ${sudo} "${venv}/bin/pip" install meson==1.8.0
${sudo} "${venv}/bin/pip" install git+https://github.com/mesonbuild/meson.git
if "${latest}"; then
${sudo} "${venv}/bin/pip" install git+https://github.com/mesonbuild/meson.git
else
${sudo} "${venv}/bin/pip" install "meson==${meson_version}"
fi
${sudo} cp "${venv}/bin/meson" .meson/meson
else
if test ! -d .meson-src; then
git clone https://github.com/mesonbuild/meson .meson-src
fi
(
cd .meson-src || exit 1
# TODO: always checkout when 1.8.0 gets released.
if git tag -l | grep -E '^1.8.0$' > /dev/null 2>&1; then
git checkout 1.8.0
fi
)
if ! "${latest}"; then
(
cd .meson-src || exit 1
git checkout "${meson_version}"
)
fi
${sudo} "${venv}/bin/pip" install pyinstaller
(
cd .meson-src || exit 1
@ -118,6 +124,7 @@ fi
if "${install}"; then
sudo cp .meson/meson /usr/local/bin/meson
sudo cp .meson/ninja /usr/local/bin/ninja
rm -fr .meson
exit 0
fi