summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Browning <jamesb.fe80@gmail.com>2022-04-12 04:52:09 -0700
committerSam James <sam@gentoo.org>2022-04-20 02:02:58 +0100
commit37c2b340b2370499d0e6230e4f8b50d079a7d096 (patch)
tree647e21d29fbe4025c2cba083f69a806b3383744b /net-misc
parentnet-ftp/filezilla: require dep libfilezilla-0.37.1 (diff)
downloadgentoo-37c2b340b2370499d0e6230e4f8b50d079a7d096.tar.gz
gentoo-37c2b340b2370499d0e6230e4f8b50d079a7d096.tar.bz2
gentoo-37c2b340b2370499d0e6230e4f8b50d079a7d096.zip
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@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-misc')
-rw-r--r--net-misc/ntpsec/files/ntpsec-1.2.1-build-notests.patch48
-rw-r--r--net-misc/ntpsec/files/ntpsec-py3-test-clarify.patch34
-rw-r--r--net-misc/ntpsec/ntpsec-1.2.1-r3.ebuild177
-rw-r--r--net-misc/ntpsec/ntpsec-9999.ebuild17
4 files changed, 272 insertions, 4 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 <jamesb.fe80@gmail.com>
+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 <jamesb.fe80@gmail.com>
+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-1.2.1-r3.ebuild b/net-misc/ntpsec/ntpsec-1.2.1-r3.ebuild
new file mode 100644
index 000000000000..f8f744dbf4a7
--- /dev/null
+++ b/net-misc/ntpsec/ntpsec-1.2.1-r3.ebuild
@@ -0,0 +1,177 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{7..9} )
+PYTHON_REQ_USE='threads(+)'
+DISTUTILS_USE_SETUPTOOLS=no
+
+inherit distutils-r1 flag-o-matic waf-utils systemd
+
+if [[ ${PV} == *9999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://gitlab.com/NTPsec/ntpsec.git"
+else
+ SRC_URI="ftp://ftp.ntpsec.org/pub/releases/${PN}-${PV}.tar.gz"
+ RESTRICT="mirror"
+ KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
+fi
+
+DESCRIPTION="The NTP reference implementation, refactored"
+HOMEPAGE="https://www.ntpsec.org/"
+
+NTPSEC_REFCLOCK=(
+ oncore trimble truetime gpsd jjy generic spectracom
+ shm pps hpgps zyfer arbiter nmea modem local
+ )
+
+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" #ionice
+REQUIRED_USE="${PYTHON_REQUIRED_USE} nist? ( rclock_local )"
+
+# net-misc/pps-tools oncore,pps
+CDEPEND="${PYTHON_DEPS}
+ sys-libs/libcap
+ dev-python/psutil[${PYTHON_USEDEP}]
+ libbsd? ( dev-libs/libbsd:0= )
+ dev-libs/openssl:0=
+ seccomp? ( sys-libs/libseccomp )
+"
+RDEPEND="${CDEPEND}
+ ntpviz? ( sci-visualization/gnuplot media-fonts/liberation-fonts )
+ !net-misc/ntp
+ !net-misc/openntpd
+ acct-group/ntp
+ acct-user/ntp
+"
+DEPEND="${CDEPEND}
+ >=app-text/asciidoc-8.6.8
+ dev-libs/libxslt
+ app-text/docbook-xsl-stylesheets
+ sys-devel/bison
+ rclock_oncore? ( net-misc/pps-tools )
+ rclock_pps? ( net-misc/pps-tools )
+"
+
+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"
+
+src_prepare() {
+ default
+
+ # Remove autostripping of binaries
+ sed -i -e '/Strip binaries/d' wscript || die
+ if ! use libbsd ; then
+ eapply "${FILESDIR}/${PN}-no-bsd.patch"
+ fi
+ # remove extra default pool servers
+ sed -i '/use-pool/s/^/#/' "${S}"/etc/ntp.d/default.conf || die
+
+ python_copy_sources
+}
+
+src_configure() {
+ is-flagq -flto* && filter-flags -flto* -fuse-linker-plugin
+
+ local string_127=""
+ local rclocks="";
+ local CLOCKSTRING=""
+
+ for refclock in ${NTPSEC_REFCLOCK[@]} ; do
+ if use rclock_${refclock} ; then
+ string_127+="$refclock,"
+ fi
+ done
+ CLOCKSTRING="`echo ${string_127}|sed 's|,$||'`"
+
+ local myconf=(
+ --notests
+ --nopyc
+ --nopyo
+ --enable-pylib ext
+ --refclock="${CLOCKSTRING}"
+ #--build-epoch="$(date +%s)"
+ $(use doc || echo "--disable-doc")
+ $(use early && echo "--enable-early-droproot")
+ $(use gdb && echo "--enable-debug-gdb")
+ $(use samba && echo "--enable-mssntp")
+ $(use seccomp && echo "--enable-seccomp")
+ $(use smear && echo "--enable-leap-smear")
+ $(use debug && echo "--enable-debug")
+ )
+
+ python_configure() {
+ waf-utils_src_configure "${myconf[@]}"
+ }
+ python_foreach_impl run_in_build_dir python_configure
+}
+
+src_compile() {
+ unset MAKEOPTS
+ python_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 --notests
+ python_fix_shebang "${ED}"
+ }
+ python_foreach_impl run_in_build_dir python_install
+ python_foreach_impl python_optimize
+
+ # Install heat generating scripts
+ use heat && dosbin "${S}"/contrib/ntpheat{,usb}
+
+ # Install the openrc files
+ newinitd "${FILESDIR}"/ntpd.rc-r2 ntp
+ newconfd "${FILESDIR}"/ntpd.confd ntp
+
+ # Install the systemd unit file
+ systemd_newunit "${FILESDIR}"/ntpd-r1.service ntpd.service
+
+ # Prepare a directory for the ntp.drift file
+ mkdir -pv "${ED}"/var/lib/ntp
+ chown ntp:ntp "${ED}"/var/lib/ntp
+ chmod 770 "${ED}"/var/lib/ntp
+ keepdir /var/lib/ntp
+
+ # Install a log rotate script
+ mkdir -pv "${ED}"/etc/logrotate.d
+ cp -v "${S}"/etc/logrotate-config.ntpd "${ED}"/etc/logrotate.d/ntpd
+
+ # Install the configuration file and sample configuration
+ cp -v "${FILESDIR}"/ntp.conf "${ED}"/etc/ntp.conf
+ cp -Rv "${S}"/etc/ntp.d/ "${ED}"/etc/
+
+ # move doc files to /usr/share/doc/"${P}"
+ use doc && mv -v "${ED}"/usr/share/doc/"${PN}" "${ED}"/usr/share/doc/"${P}"/html
+}
+
+pkg_postinst() {
+ einfo "If you want to serve time on your local network, then"
+ einfo "you should disable all the ref_clocks unless you have"
+ einfo "one and can get stable time from it. Feel free to try"
+ einfo "it but PPS probably won't work unless you have a UART"
+ einfo "GPS that actually provides PPS messages."
+}
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