From 71b11fdbdb103dba980baf3905dc12eeb1deaf80 Mon Sep 17 00:00:00 2001 From: Michal Vasilek Date: Mon, 28 Feb 2022 14:40:07 +0100 Subject: [PATCH] xbps-src: add make_check_pre $make_check_pre can be used for wrapper commands like xvfb-run or dbus-run-session which are common ways to make tests work. This way many templates can avoid defining their own do_check function. --- Manual.md | 3 +++ common/build-style/cargo.sh | 2 +- common/build-style/cmake.sh | 2 +- common/build-style/configure.sh | 2 +- common/build-style/gnu-configure.sh | 2 +- common/build-style/gnu-makefile.sh | 2 +- common/build-style/meson.sh | 2 +- common/build-style/perl-ModuleBuild.sh | 2 +- common/build-style/perl-module.sh | 2 +- common/build-style/python-module.sh | 2 +- common/build-style/python3-module.sh | 4 ++-- common/build-style/python3-pep517.sh | 2 +- common/build-style/raku-dist.sh | 2 +- common/environment/setup/sourcepkg.sh | 2 +- 14 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Manual.md b/Manual.md index 8ec755499bb..1ce07792f54 100644 --- a/Manual.md +++ b/Manual.md @@ -600,6 +600,9 @@ path of the Python wheel produced by the build phase that will be installed; whe `python-pep517` build style will look for a wheel matching the package name and version in the current directory with respect to the install. +- `make_check_pre` The expression in front of `${make_cmd}`. This can be used for wrapper commands +or for setting environment variables for the check command. By default empty. + - `patch_args` The arguments to be passed in to the `patch(1)` command when applying patches to the package sources during `do_patch()`. Patches are stored in `srcpkgs//patches` and must be in `-p1` format. By default set to `-Np1`. diff --git a/common/build-style/cargo.sh b/common/build-style/cargo.sh index 53c489772e7..573a6900361 100644 --- a/common/build-style/cargo.sh +++ b/common/build-style/cargo.sh @@ -11,7 +11,7 @@ do_build() { do_check() { : ${make_cmd:=cargo} - ${make_cmd} test --release --target ${RUST_TARGET} ${configure_args} \ + ${make_check_pre} ${make_cmd} test --release --target ${RUST_TARGET} ${configure_args} \ ${make_check_args} } diff --git a/common/build-style/cmake.sh b/common/build-style/cmake.sh index 33a556be001..7d1d675c3ab 100644 --- a/common/build-style/cmake.sh +++ b/common/build-style/cmake.sh @@ -116,7 +116,7 @@ do_check() { : ${make_check_target:=test} - ${make_cmd} ${make_check_args} ${make_check_target} + ${make_check_pre} ${make_cmd} ${make_check_args} ${make_check_target} } do_install() { diff --git a/common/build-style/configure.sh b/common/build-style/configure.sh index 0963fc34793..6f2c94ace69 100644 --- a/common/build-style/configure.sh +++ b/common/build-style/configure.sh @@ -29,7 +29,7 @@ do_check() { : ${make_cmd:=make} : ${make_check_target:=check} - ${make_cmd} ${make_check_args} ${make_check_target} + ${make_check_pre} ${make_cmd} ${make_check_args} ${make_check_target} } do_install() { diff --git a/common/build-style/gnu-configure.sh b/common/build-style/gnu-configure.sh index 8121136cd12..f66b081955e 100644 --- a/common/build-style/gnu-configure.sh +++ b/common/build-style/gnu-configure.sh @@ -30,7 +30,7 @@ do_check() { : ${make_cmd:=make} : ${make_check_target:=check} - ${make_cmd} ${make_check_args} ${make_check_target} + ${make_check_pre} ${make_cmd} ${make_check_args} ${make_check_target} } do_install() { diff --git a/common/build-style/gnu-makefile.sh b/common/build-style/gnu-makefile.sh index d7ea148fc48..2492749bd84 100644 --- a/common/build-style/gnu-makefile.sh +++ b/common/build-style/gnu-makefile.sh @@ -30,7 +30,7 @@ do_check() { : ${make_cmd:=make} : ${make_check_target:=check} - ${make_cmd} ${make_check_args} ${make_check_target} + ${make_check_pre} ${make_cmd} ${make_check_args} ${make_check_target} } do_install() { diff --git a/common/build-style/meson.sh b/common/build-style/meson.sh index ab9f2cacfd0..a7bd901e976 100644 --- a/common/build-style/meson.sh +++ b/common/build-style/meson.sh @@ -138,7 +138,7 @@ do_check() { : ${make_check_target:=test} : ${meson_builddir:=build} - ${make_cmd} -C ${meson_builddir} ${makejobs} ${make_check_args} ${make_check_target} + ${make_check_pre} ${make_cmd} -C ${meson_builddir} ${makejobs} ${make_check_args} ${make_check_target} } do_install() { diff --git a/common/build-style/perl-ModuleBuild.sh b/common/build-style/perl-ModuleBuild.sh index a84373b5b0b..f21d2b0efb4 100644 --- a/common/build-style/perl-ModuleBuild.sh +++ b/common/build-style/perl-ModuleBuild.sh @@ -41,7 +41,7 @@ do_check() { if [ ! -x ./Build ]; then msg_error "$pkgver: cannot find ./Build script!\n" fi - ./Build test + ${make_check_pre} ./Build test } do_install() { diff --git a/common/build-style/perl-module.sh b/common/build-style/perl-module.sh index b9a01b13cfa..9126091cb2c 100644 --- a/common/build-style/perl-module.sh +++ b/common/build-style/perl-module.sh @@ -79,7 +79,7 @@ do_check() { : ${make_cmd:=make} : ${make_check_target:=test} - ${make_cmd} ${make_check_args} ${make_check_target} + ${make_check_pre} ${make_cmd} ${make_check_args} ${make_check_target} } do_install() { diff --git a/common/build-style/python-module.sh b/common/build-style/python-module.sh index 15cf7577adb..b80801a6724 100644 --- a/common/build-style/python-module.sh +++ b/common/build-style/python-module.sh @@ -49,7 +49,7 @@ do_check() { fi fi - python${pyver} setup.py ${make_check_target:-test} ${make_check_args} + ${make_check_pre} python${pyver} setup.py ${make_check_target:-test} ${make_check_args} rm build done } diff --git a/common/build-style/python3-module.sh b/common/build-style/python3-module.sh index 093bdae8a00..8daf40e6921 100644 --- a/common/build-style/python3-module.sh +++ b/common/build-style/python3-module.sh @@ -25,7 +25,7 @@ do_build() { do_check() { if python3 -c 'import pytest' >/dev/null 2>&1; then - PYTHONPATH="$(cd build/lib* && pwd)" \ + ${make_check_pre} PYTHONPATH="$(cd build/lib* && pwd)" \ python3 -m pytest ${make_check_args} ${make_check_target} else # Fall back to deprecated setup.py test orchestration without pytest @@ -37,7 +37,7 @@ do_check() { fi : ${make_check_target:=test} - python3 setup.py ${make_check_target} ${make_check_args} + ${make_check_pre} python3 setup.py ${make_check_target} ${make_check_args} fi } diff --git a/common/build-style/python3-pep517.sh b/common/build-style/python3-pep517.sh index 075f954a1a6..a733a521fb3 100644 --- a/common/build-style/python3-pep517.sh +++ b/common/build-style/python3-pep517.sh @@ -14,7 +14,7 @@ do_build() { do_check() { if python3 -c 'import pytest' >/dev/null 2>&1; then - python3 -m pytest ${make_check_args} ${make_check_target} + ${make_check_pre} python3 -m pytest ${make_check_args} ${make_check_target} else msg_warn "Unable to determine tests for PEP517 Python templates" return 0 diff --git a/common/build-style/raku-dist.sh b/common/build-style/raku-dist.sh index 3b1f28d6421..bbbba96e714 100644 --- a/common/build-style/raku-dist.sh +++ b/common/build-style/raku-dist.sh @@ -3,7 +3,7 @@ # do_check() { - RAKULIB=lib prove -r -e raku t/ + ${make_check_pre} RAKULIB=lib prove -r -e raku t/ } do_install() { diff --git a/common/environment/setup/sourcepkg.sh b/common/environment/setup/sourcepkg.sh index bc06f745b78..e0e16d7915c 100644 --- a/common/environment/setup/sourcepkg.sh +++ b/common/environment/setup/sourcepkg.sh @@ -7,7 +7,7 @@ unset -v archs distfiles checksum build_style build_helper nocross broken unset -v configure_script configure_args wrksrc build_wrksrc create_wrksrc unset -v make_build_args make_check_args make_install_args unset -v make_build_target make_check_target make_install_target -unset -v make_cmd meson_cmd gem_cmd fetch_cmd +unset -v make_cmd meson_cmd gem_cmd fetch_cmd make_check_pre unset -v python_version stackage unset -v cmake_builddir meson_builddir unset -v meson_crossfile