commit:     37c2b340b2370499d0e6230e4f8b50d079a7d096
Author:     James Browning <jamesb.fe80 <AT> gmail <DOT> com>
AuthorDate: Tue Apr 12 11:52:09 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 20 01:02:58 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37c2b340

net-misc/ntpsec: Try to only run tests in src_test only

Since ./waf test runs all the test, this eliminates the need for
the tests useflag which filled that space. Thus it's eliminated.

Bug: https://bugs.gentoo.org/795522
Closes: https://bugs.gentoo.org/838109
Signed-off-by: James T Browning <JamesB.fe80 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../ntpsec/files/ntpsec-1.2.1-build-notests.patch  | 48 ++++++++++++++++++++++
 .../ntpsec/files/ntpsec-py3-test-clarify.patch     | 34 +++++++++++++++
 .../{ntpsec-9999.ebuild => ntpsec-1.2.1-r3.ebuild} | 23 ++++++++---
 net-misc/ntpsec/ntpsec-9999.ebuild                 | 17 ++++++--
 4 files changed, 112 insertions(+), 10 deletions(-)

diff --git a/net-misc/ntpsec/files/ntpsec-1.2.1-build-notests.patch 
b/net-misc/ntpsec/files/ntpsec-1.2.1-build-notests.patch
new file mode 100644
index 000000000000..dab51a97fc0a
--- /dev/null
+++ b/net-misc/ntpsec/files/ntpsec-1.2.1-build-notests.patch
@@ -0,0 +1,48 @@
+From 1a7bb2e3a2749bd709ea4cf10b66b6f6d05aaf9d Mon Sep 17 00:00:00 2001
+From: James Browning <[email protected]>
+Date: Sun, 10 Apr 2022 07:53:37 -0700
+Subject: [PATCH] I: NTPsec build does not repect --notests
+
+STR: (run the following)
+- git clone https://gitlab.com/NTPsec/ntpsec
+- cd ntpsec
+- ./waf configure build --notests -p
+
+AR: NTPsec runs tests despite having a parameter telling it not to
+ER: NTPsec should not run tests when it has been told not to
+---
+ wscript | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/wscript b/wscript
+index c1d765046..d8a20b82e 100644
+--- a/wscript
++++ b/wscript
+@@ -1131,6 +1131,7 @@ def build(ctx):
+     ctx.manpage(8, "ntpclients/ntpsnmpd-man.adoc")
+ 
+     # Skip running unit tests on a cross compile build
++    from waflib import Options
+     if not ctx.env.ENABLE_CROSS:
+         # Force re-running of tests.  Same as 'waf --alltests'
+         if ctx.cmd == "check":
+@@ -1139,6 +1140,8 @@ def build(ctx):
+             # Print log if -v is supplied
+             if verbose > 0:
+                 ctx.add_post_fun(test_print_log)
++        elif Options.options.no_tests:
++            return
+ 
+         # Test binaries
+         ctx.add_post_fun(bin_test)
+@@ -1152,7 +1155,6 @@ def build(ctx):
+         ctx.add_post_fun(bin_test_summary)
+     else:
+         pprint("YELLOW", "Unit test runner skipped on a cross-compiled 
build.")
+-        from waflib import Options
+         Options.options.no_tests = True
+ 
+     if ctx.cmd == "build":
+-- 
+2.32.0
+

diff --git a/net-misc/ntpsec/files/ntpsec-py3-test-clarify.patch 
b/net-misc/ntpsec/files/ntpsec-py3-test-clarify.patch
new file mode 100644
index 000000000000..027c3df18ad2
--- /dev/null
+++ b/net-misc/ntpsec/files/ntpsec-py3-test-clarify.patch
@@ -0,0 +1,34 @@
+From f360741dec76a9c9d831f0b547596891ea321599 Mon Sep 17 00:00:00 2001
+From: James Browning <[email protected]>
+Date: Sun, 10 Apr 2022 16:23:34 -0700
+Subject: [PATCH] clean test output up in Python 3
+
+---
+ wafhelpers/test.py | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/wafhelpers/test.py b/wafhelpers/test.py
+index 9351a5675..6bba34881 100644
+--- a/wafhelpers/test.py
++++ b/wafhelpers/test.py
+@@ -31,12 +31,13 @@ def test_print_log(ctx):
+         pprint("YELLOW", "RETURN VALUE:", retval)
+         print("")
+ 
+-        if retval or error:
++        if retval:
+             pprint("RED", "****** ERROR ******\n")
+ 
+-            print(error or lines)
++            print(polystr(error) or polystr(lines))
+ 
+-        if (not retval) and (not error):
+-            pprint("GREEN", "****** LOG ******\n", lines)
++        else:
++            pprint("GREEN", "****** LOG ******\n",
++                   polystr(lines), polystr(error))
+ 
+         print("")
+-- 
+2.32.0
+

diff --git a/net-misc/ntpsec/ntpsec-9999.ebuild 
b/net-misc/ntpsec/ntpsec-1.2.1-r3.ebuild
similarity index 88%
copy from net-misc/ntpsec/ntpsec-9999.ebuild
copy to net-misc/ntpsec/ntpsec-1.2.1-r3.ebuild
index 2065ee52d6a6..f8f744dbf4a7 100644
--- a/net-misc/ntpsec/ntpsec-9999.ebuild
+++ b/net-misc/ntpsec/ntpsec-1.2.1-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -15,7 +15,7 @@ if [[ ${PV} == *9999* ]]; then
 else
        SRC_URI="ftp://ftp.ntpsec.org/pub/releases/${PN}-${PV}.tar.gz";
        RESTRICT="mirror"
-       KEYWORDS="amd64 arm arm64 ~riscv ~x86"
+       KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
 fi
 
 DESCRIPTION="The NTP reference implementation, refactored"
@@ -30,7 +30,7 @@ IUSE_NTPSEC_REFCLOCK=${NTPSEC_REFCLOCK[@]/#/rclock_}
 
 LICENSE="HPND MIT BSD-2 BSD CC-BY-SA-4.0"
 SLOT="0"
-IUSE="${IUSE_NTPSEC_REFCLOCK} debug doc early gdb heat libbsd nist ntpviz 
samba seccomp smear tests" #ionice
+IUSE="${IUSE_NTPSEC_REFCLOCK} debug doc early gdb heat libbsd nist ntpviz 
samba seccomp smear" #ionice
 REQUIRED_USE="${PYTHON_REQUIRED_USE} nist? ( rclock_local )"
 
 # net-misc/pps-tools oncore,pps
@@ -59,6 +59,10 @@ DEPEND="${CDEPEND}
 
 PATCHES=(
        "${FILESDIR}/${PN}-1.1.9-remove-asciidoctor-from-config.patch"
+       "${FILESDIR}/${PN}-1.2.1-seccomp-rollup.patch"
+       "${FILESDIR}/${PN}-1.2.1-seccomp-rseq-glibc-2.35.patch"
+       "${FILESDIR}/${PN}-1.2.1-build-notests.patch"
+       "${FILESDIR}/${PN}-py3-test-clarify.patch"
 )
 
 WAF_BINARY="${S}/waf"
@@ -92,6 +96,7 @@ src_configure() {
        CLOCKSTRING="`echo ${string_127}|sed 's|,$||'`"
 
        local myconf=(
+               --notests
                --nopyc
                --nopyo
                --enable-pylib ext
@@ -103,7 +108,6 @@ src_configure() {
                $(use samba     && echo "--enable-mssntp")
                $(use seccomp   && echo "--enable-seccomp")
                $(use smear     && echo "--enable-leap-smear")
-               $(use tests     && echo "--alltests")
                $(use debug     && echo "--enable-debug")
        )
 
@@ -116,14 +120,21 @@ src_configure() {
 src_compile() {
        unset MAKEOPTS
        python_compile() {
-               waf-utils_src_compile
+               waf-utils_src_compile --notests
+       }
+       python_foreach_impl run_in_build_dir python_compile
+}
+
+src_test() {
+       python_compile() {
+               waf-utils_src_compile check
        }
        python_foreach_impl run_in_build_dir python_compile
 }
 
 src_install() {
        python_install() {
-               waf-utils_src_install
+               waf-utils_src_install --notests
                python_fix_shebang "${ED}"
        }
        python_foreach_impl run_in_build_dir python_install

diff --git a/net-misc/ntpsec/ntpsec-9999.ebuild 
b/net-misc/ntpsec/ntpsec-9999.ebuild
index 2065ee52d6a6..9916c5768c10 100644
--- a/net-misc/ntpsec/ntpsec-9999.ebuild
+++ b/net-misc/ntpsec/ntpsec-9999.ebuild
@@ -30,7 +30,7 @@ IUSE_NTPSEC_REFCLOCK=${NTPSEC_REFCLOCK[@]/#/rclock_}
 
 LICENSE="HPND MIT BSD-2 BSD CC-BY-SA-4.0"
 SLOT="0"
-IUSE="${IUSE_NTPSEC_REFCLOCK} debug doc early gdb heat libbsd nist ntpviz 
samba seccomp smear tests" #ionice
+IUSE="${IUSE_NTPSEC_REFCLOCK} debug doc early gdb heat libbsd nist ntpviz 
samba seccomp smear" #ionice
 REQUIRED_USE="${PYTHON_REQUIRED_USE} nist? ( rclock_local )"
 
 # net-misc/pps-tools oncore,pps
@@ -59,6 +59,7 @@ DEPEND="${CDEPEND}
 
 PATCHES=(
        "${FILESDIR}/${PN}-1.1.9-remove-asciidoctor-from-config.patch"
+       "${FILESDIR}/${PN}-py3-test-clarify.patch"
 )
 
 WAF_BINARY="${S}/waf"
@@ -92,6 +93,7 @@ src_configure() {
        CLOCKSTRING="`echo ${string_127}|sed 's|,$||'`"
 
        local myconf=(
+               --notests
                --nopyc
                --nopyo
                --enable-pylib ext
@@ -103,7 +105,6 @@ src_configure() {
                $(use samba     && echo "--enable-mssntp")
                $(use seccomp   && echo "--enable-seccomp")
                $(use smear     && echo "--enable-leap-smear")
-               $(use tests     && echo "--alltests")
                $(use debug     && echo "--enable-debug")
        )
 
@@ -116,14 +117,22 @@ src_configure() {
 src_compile() {
        unset MAKEOPTS
        python_compile() {
-               waf-utils_src_compile
+               waf-utils_src_compile --notests
+       }
+       python_foreach_impl run_in_build_dir python_compile
+}
+
+src_test() {
+       debug-print-function ${FUNCNAME} "$@"
+       python_compile() {
+               waf-utils_src_compile check
        }
        python_foreach_impl run_in_build_dir python_compile
 }
 
 src_install() {
        python_install() {
-               waf-utils_src_install
+               waf-utils_src_install --notests
                python_fix_shebang "${ED}"
        }
        python_foreach_impl run_in_build_dir python_install

Reply via email to