From 7538e9265590b6944d0f0513f5b45f60a0d60e67 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Mon, 2 Jun 2025 16:01:09 +0300 Subject: [PATCH] [#3867] Hammer: Pin Meson version to 1.8.1 --- doc/sphinx/arm/hammer.rst | 15 --------------- hammer.py | 11 ++++------- meson.sh | 37 ++++++++++++++++++++++--------------- 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/doc/sphinx/arm/hammer.rst b/doc/sphinx/arm/hammer.rst index b3e61fcf18..4abe4e185c 100644 --- a/doc/sphinx/arm/hammer.rst +++ b/doc/sphinx/arm/hammer.rst @@ -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 diff --git a/hammer.py b/hammer.py index 0de0a47b07..33c560da2d 100755 --- a/hammer.py +++ b/hammer.py @@ -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: diff --git a/meson.sh b/meson.sh index a7b7855221..2a99c0ebbd 100755 --- a/meson.sh +++ b/meson.sh @@ -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