commit:     457fa7bdd57e4610c61450018858d3c0a6791e9d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 21 07:46:53 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 21 07:48:50 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=457fa7bd

app-antivirus/clamav: fix running tests

- Adapt to CMake (don't use 'emake ...' anymore): use the default
  cmake_src_test which does the job for us;

- Pretend Valgrind isn't installed to avoid running expensive, somewhat flaky
  (within sandbox etc), and demanding tests (need certain config on the host
  to ensure Valgrind works properly);

- Depend on pytest for tests too as per upstream. Used to generate
  some of the test files.

Closes: https://bugs.gentoo.org/818673
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-antivirus/clamav/clamav-0.104.0-r1.ebuild | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/app-antivirus/clamav/clamav-0.104.0-r1.ebuild 
b/app-antivirus/clamav/clamav-0.104.0-r1.ebuild
index ee0e19b9500..e78447e51d5 100644
--- a/app-antivirus/clamav/clamav-0.104.0-r1.ebuild
+++ b/app-antivirus/clamav/clamav-0.104.0-r1.ebuild
@@ -3,7 +3,8 @@
 
 EAPI=7
 
-inherit cmake flag-o-matic systemd tmpfiles
+PYTHON_COMPAT=( python3_{8..10} )
+inherit cmake flag-o-matic python-any-r1 systemd tmpfiles
 
 DESCRIPTION="Clam Anti-Virus Scanner"
 HOMEPAGE="https://www.clamav.net/";
@@ -44,7 +45,11 @@ CDEPEND="acct-group/clamav
 # TODO: there is no way to use this with the new build system instead of the 
bundled one
 #      dev-libs/tomsfastmath
 BDEPEND="virtual/pkgconfig
-       doc? ( app-doc/doxygen )"
+       doc? ( app-doc/doxygen )
+       test? (
+               ${PYTHON_DEPS}
+               $(python_gen_any_dep 'dev-python/pytest[${PYTHON_USEDEP}]')
+       )"
 DEPEND="${CDEPEND}
        test? ( dev-libs/check )"
 RDEPEND="${CDEPEND}
@@ -54,6 +59,14 @@ PATCHES=(
        "${FILESDIR}/${PN}-0.104.0-ncurses_detection.patch"
 )
 
+python_check_deps() {
+       has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+       use test && python-any-r1_pkg_setup
+}
+
 src_configure() {
        use elibc_musl && append-ldflags -lfts
        use ppc64 && append-flags -mminimal-toc
@@ -76,6 +89,10 @@ src_configure() {
                -DENABLE_DOXYGEN=$(usex doc)
                -DENABLE_UNRAR=$(usex rar ON OFF)
                -DENABLE_TESTS=$(usex test ON OFF)
+               # Used to enable some more tests but doesn't behave well in
+               # sandbox necessarily(?) + needs certain debug symbols present
+               # in e.g. glibc.
+               -DCMAKE_DISABLE_FIND_PACKAGE_Valgrind=ON
                -DENABLE_STATIC_LIB=OFF
                -DENABLE_SHARED_LIB=ON
                -DENABLE_SYSTEMD=$(usex systemd ON OFF)
@@ -177,10 +194,6 @@ src_install() {
        find "${ED}" -name '*.la' -delete || die
 }
 
-src_test() {
-       emake quick-check
-}
-
 pkg_postinst() {
        if ! use libclamav-only ; then
                if use systemd ; then

Reply via email to