diff --git a/contrib/ci/fwupd_setup_helpers.py b/contrib/ci/fwupd_setup_helpers.py index f0b4736b9..3f636e317 100755 --- a/contrib/ci/fwupd_setup_helpers.py +++ b/contrib/ci/fwupd_setup_helpers.py @@ -16,6 +16,9 @@ ENDC = "\033[0m" # Minimum version of markdown required MINIMUM_MARKDOWN = (3, 3, 3) +# Minimum meson required +MINIMUM_MESON = "0.60.0" + def get_possible_profiles(): return ["fedora", "centos", "debian", "ubuntu", "arch", "void"] @@ -33,7 +36,16 @@ def detect_profile(): return target -def test_markdown(): +def pip_install_package(debug, name): + import subprocess + + cmd = ["python3", "-m", "pip", "install", "--upgrade", name] + if debug: + print(cmd) + subprocess.call(cmd) + + +def test_markdown(debug): try: import markdown @@ -42,7 +54,16 @@ def test_markdown(): new_enough = False if not new_enough: print("python3-markdown must be installed/upgraded") - sys.exit(not new_enough) + pip_install_package(debug, "markdown") + + +def test_meson(debug): + from importlib.metadata import version + + new_enough = version("meson") >= MINIMUM_MESON + if not new_enough: + print("meson must be installed/upgraded") + pip_install_package(debug, "meson") def parse_dependencies(OS, variant, requested_type): @@ -146,6 +167,7 @@ if __name__ == "__main__": choices=[ "get-dependencies", "test-markdown", + "test-meson", "detect-profile", "install-dependencies", "install-pip", @@ -178,7 +200,9 @@ if __name__ == "__main__": # command to run if command == "test-markdown": - test_markdown() + test_markdown(args.debug) + elif command == "test-meson": + test_meson(args.debug) elif command == "detect-profile": print(detect_profile()) elif command == "get-dependencies": diff --git a/contrib/ci/ubuntu.sh b/contrib/ci/ubuntu.sh index 38cc13325..0f6e1f60e 100755 --- a/contrib/ci/ubuntu.sh +++ b/contrib/ci/ubuntu.sh @@ -5,6 +5,15 @@ set -x #check for and install missing dependencies ./contrib/ci/fwupd_setup_helpers.py install-dependencies --yes -o ubuntu +#check we have pip +./contrib/ci/fwupd_setup_helpers.py install-pip --yes -o ubuntu + +#check meson is new enough +./contrib/ci/fwupd_setup_helpers.py test-meson + +#check markdown is new enough +./contrib/ci/fwupd_setup_helpers.py test-markdown + #clone test firmware if necessary . ./contrib/ci/get_test_firmware.sh diff --git a/contrib/setup b/contrib/setup index 35d790508..867dad41f 100755 --- a/contrib/setup +++ b/contrib/setup @@ -56,6 +56,7 @@ setup_unsafe_polkit_rules() { read -p "Install developer-friendly **unsafe** PolicyKit rules into /etc/polkit-1/rules.d? (y/N) " question if [ "$question" = "y" ]; then + sudo mkdir -p /etc/polkit-1/rules.d sudo cp ./policy/org.freedesktop.fwupd-unsafe.rules /etc/polkit-1/rules.d/ fi } @@ -111,9 +112,12 @@ setup_prepush() check_markdown() { - if ! python3 $HELPER test-markdown; then - install_pip markdown --upgrade - fi + python3 $HELPER test-markdown +} + +check_meson() +{ + python3 $HELPER test-meson } detect_os() @@ -173,6 +177,7 @@ if [ -t 2 ]; then esac setup_unsafe_polkit_rules check_markdown + check_meson setup_vscode rename_branch setup_prepush