commit:     3ba2afcc77d13823ee5b9e935619b8be08b11790
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue May 17 04:51:06 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 17 05:33:58 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ba2afcc

app-crypt/gpgme: conditionally build tests; die if tests can't be run

1. Conditionally build tests which gives us a neat speedup for build time;

2. If tests are explicitly requested and we can't run them b/c of WORKDIR 
length,
let's bail out. It's important that we don't get a false positive that
the package is okay (especially given its importance).

(Noticed when poking at the slibtool bug, although I don't think this will
actually fix anything there.)

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

 app-crypt/gpgme/gpgme-1.17.1.ebuild | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/app-crypt/gpgme/gpgme-1.17.1.ebuild 
b/app-crypt/gpgme/gpgme-1.17.1.ebuild
index 1865282c490a..c70a73811293 100644
--- a/app-crypt/gpgme/gpgme-1.17.1.ebuild
+++ b/app-crypt/gpgme/gpgme-1.17.1.ebuild
@@ -20,7 +20,8 @@ LICENSE="GPL-2 LGPL-2.1"
 # Subslot: SONAME of each: <libgpgme.libgpgmepp.libqgpgme>
 SLOT="1/11.6.15"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="common-lisp static-libs +cxx python qt5"
+IUSE="common-lisp static-libs +cxx python qt5 test"
+RESTRICT="!test? ( test )"
 
 # Note: On each bump, update dep bounds on each version from configure.ac!
 RDEPEND=">=app-crypt/gnupg-2
@@ -30,7 +31,9 @@ RDEPEND=">=app-crypt/gnupg-2
        qt5? ( dev-qt/qtcore:5 )"
        #doc? ( app-doc/doxygen[dot] )
 DEPEND="${RDEPEND}
-       qt5? ( dev-qt/qttest:5 )"
+       test? (
+               qt5? ( dev-qt/qttest:5 )
+       )"
 BDEPEND="python? ( dev-lang/swig )
        verify-sig? ( sec-keys/openpgp-keys-gnupg )"
 
@@ -53,9 +56,9 @@ src_prepare() {
        addpredict /run/user/$(id -u)/gnupg
 
        local MAX_WORKDIR=66
-       if [[ "${#WORKDIR}" -gt "${MAX_WORKDIR}" ]]; then
-               ewarn "Disabling tests as WORKDIR '${WORKDIR}' is longer than 
${MAX_WORKDIR} which will fail tests"
-               SKIP_TESTS=1
+       if use test && [[ "${#WORKDIR}" -gt "${MAX_WORKDIR}" ]]; then
+               eerror "Unable to run tests as WORKDIR='${WORKDIR}' is longer 
than ${MAX_WORKDIR} which causes failure!"
+               die "Could not run tests as requested with too-long WORKDIR."
        fi
 
        # Make best effort to allow longer PORTAGE_TMPDIR
@@ -66,6 +69,7 @@ src_prepare() {
 
 src_configure() {
        local languages=()
+
        use common-lisp && languages+=( "cl" )
        use cxx && languages+=( "cpp" )
        if use qt5; then
@@ -77,7 +81,7 @@ src_configure() {
 
        # bug #811933 for libassuan prefix
        econf \
-               $([[ -n "${SKIP_TESTS}" ]] && echo "--disable-gpg-test 
--disable-gpgsm-test") \
+               $(use test || echo "--disable-gpgconf-test --disable-gpg-test 
--disable-gpgsm-test --disable-g13-test") \
                --enable-languages="${languages[*]}" \
                --with-libassuan-prefix="${ESYSROOT}"/usr \
                $(use_enable static-libs static)
@@ -93,9 +97,8 @@ src_compile() {
 }
 
 src_test() {
-       [[ -z "${SKIP_TESTS}" ]] || return
-
        default
+
        if use python; then
                test_python() {
                        emake -C lang/python/tests check \
@@ -109,11 +112,13 @@ src_test() {
 
 src_install() {
        default
+
        do_python
+
        find "${ED}" -type f -name '*.la' -delete || die
 
-       # backward compatibility for gentoo
-       # in the past we had slots
+       # Backward compatibility for gentoo
+       # (in the past, we had slots)
        dodir /usr/include/gpgme
        dosym ../gpgme.h /usr/include/gpgme/gpgme.h
 }

Reply via email to