commit: f21808ed835f22f93cc07992cf36685cf34ab9aa Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sat Apr 19 05:14:06 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Apr 19 05:16:15 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f21808ed
net-misc/ntpsec: add 1.2.4 Signed-off-by: Sam James <sam <AT> gentoo.org> net-misc/ntpsec/Manifest | 2 + .../ntpsec/files/ntpsec-1.2.4-pep517-no-egg.patch | 38 ++++ net-misc/ntpsec/ntpsec-1.2.4.ebuild | 193 +++++++++++++++++++++ 3 files changed, 233 insertions(+) diff --git a/net-misc/ntpsec/Manifest b/net-misc/ntpsec/Manifest index f6afe953cafe..c488008ea01f 100644 --- a/net-misc/ntpsec/Manifest +++ b/net-misc/ntpsec/Manifest @@ -1,2 +1,4 @@ DIST ntpsec-1.2.3.tar.gz 2725081 BLAKE2B d39a4d08790949afb28b843739a410624a8d862bfc25afd4e6c7dc55be43e41f3c89823406c60fb911496e7a3db51d6fa83c8bcda9b9686708c36154c2fe9686 SHA512 6baecf32f499fc12c2ef0b44360072b61ab9e8b52ec7ead64ff43a27b5a57431db939d4ce1fad92d38def981f6256a1d8ede0c0cdc5abb50d861be729255eee2 DIST ntpsec-1.2.3.tar.gz.asc 833 BLAKE2B f0d6a0b163a7f9214da6d6eb1982f87387a7087efb740ec146f55362381aa101a5a8e40c27f121ca6607c0a5c429b1e06ecaf9a9ab5392d836535430cf6575fa SHA512 17280e3092e7e9de0ddae0723637a261d3a740d916ce0f016c44c6010672cfe2fc39b45f86257cfa5bd29f1f11895f8bd583c76765c6484489027cbc82dbe6b2 +DIST ntpsec-1.2.4.tar.gz 2736913 BLAKE2B fcff3460c7676b08b18dfca3fc6a67a4788682c75a427626a4b636b844856a94f16d72b007d4ca7396b4813700969a1c614ce7fc50bb7b08f59242cca8003630 SHA512 f3e8494dd669fa2e4ac61721efe38c26a615f3fe38e659e33ea9d0994d67d779600c4ff6e65b023e6252c478ffc90a51baa90aeecc9f17daaf3f785273269efc +DIST ntpsec-1.2.4.tar.gz.asc 833 BLAKE2B e8c1c2a94e19ca9746d68cd2d0ef56345773cc0dfc84168b6e0451eec78476d275dbd66cfd28c14333a7aa8ddb2d895459aff755dfd1106347dac8faef2cb24a SHA512 001f27bb418863b265b6ccab01be584a6941be4e4426fa1deca420833bdd5792ded983d06deb2b7352dccf051033882403c5ac2d81d20deaa5e4a0542e1a95d8 diff --git a/net-misc/ntpsec/files/ntpsec-1.2.4-pep517-no-egg.patch b/net-misc/ntpsec/files/ntpsec-1.2.4-pep517-no-egg.patch new file mode 100644 index 000000000000..a84e5942786d --- /dev/null +++ b/net-misc/ntpsec/files/ntpsec-1.2.4-pep517-no-egg.patch @@ -0,0 +1,38 @@ +diff --git a/pylib/ntp-in.egg-info b/pylib/ntp-in.egg-info +deleted file mode 100644 +index b672a8431..000000000 +--- a/pylib/ntp-in.egg-info ++++ /dev/null +@@ -1,12 +0,0 @@ +-Metadata-Version: 1.0 +-Name: ntpsec +-Version: @NTPSEC_VERSION_EXTENDED@ +-Platform: POSIX +-Summary: The NTP reference implementation, refactored +-Home-page: https://ntpsec.org/ +-License: Beerware, BSD-2-Clause, BSD-3-Clause, BSD-4-Clause, CC-BY-4.0, ISC, MIT, NTP +-Description: +- The Network Time Protocol suite, refactored +-Author: the NTPsec project +-Author-email: [email protected] +-Keywords: +\ No newline at end of file +diff --git a/pylib/wscript b/pylib/wscript +index d010802..6e4a956 100644 +--- a/pylib/wscript ++++ b/pylib/wscript +@@ -101,11 +101,9 @@ def build(ctx): + install_path='${PYTHONDIR}/ntp' + ) + +- # pep241 lay an egg +- egg = ['ntp-%s.egg-info' % ctx.env.NTPSEC_VERSION] ++ # pep517 pyproject.toml + ctx( + features="subst", +- source=['ntp-in.egg-info'], +- target=egg ++ source=['pyproject.toml'], ++ target=['../pyproject.toml'] + ) +- ctx.install_files(ctx.env.PYTHONDIR, egg) diff --git a/net-misc/ntpsec/ntpsec-1.2.4.ebuild b/net-misc/ntpsec/ntpsec-1.2.4.ebuild new file mode 100644 index 000000000000..c799b205251c --- /dev/null +++ b/net-misc/ntpsec/ntpsec-1.2.4.ebuild @@ -0,0 +1,193 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_EXT=1 +DISTUTILS_USE_PEP517="flit" +PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_REQ_USE='threads(+)' + +inherit distutils-r1 flag-o-matic multiprocessing waf-utils systemd + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://gitlab.com/NTPsec/ntpsec.git" +else + VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/ntpsec.asc + inherit verify-sig + SRC_URI=" + https://ftp.ntpsec.org/pub/releases/${P}.tar.gz + verify-sig? ( https://ftp.ntpsec.org/pub/releases/${P}.tar.gz.asc ) + " + KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86" + + BDEPEND="verify-sig? ( sec-keys/openpgp-keys-ntpsec )" +fi + +DESCRIPTION="The NTP reference implementation, refactored" +HOMEPAGE="https://www.ntpsec.org/" + +LICENSE="HPND MIT BSD-2 BSD CC-BY-SA-4.0" +SLOT="0" + +NTPSEC_REFCLOCK=( + oncore trimble truetime gpsd jjy generic spectracom + shm pps hpgps zyfer arbiter nmea modem local +) + +IUSE="${NTPSEC_REFCLOCK[@]} debug doc early heat libbsd nist ntpviz samba seccomp smear test" #ionice +REQUIRED_USE="${PYTHON_REQUIRED_USE} nist? ( local )" +RESTRICT="!test? ( test )" + +# net-misc/pps-tools oncore,pps +DEPEND=" + ${PYTHON_DEPS} + dev-libs/openssl:= + dev-python/psutil[${PYTHON_USEDEP}] + sys-libs/libcap + libbsd? ( dev-libs/libbsd:0= ) + seccomp? ( sys-libs/libseccomp ) + oncore? ( net-misc/pps-tools ) + pps? ( net-misc/pps-tools ) +" +RDEPEND=" + ${DEPEND} + !net-misc/ntp + !net-misc/openntpd + acct-group/ntp + acct-user/ntp + ntpviz? ( + media-fonts/liberation-fonts + sci-visualization/gnuplot + ) +" +BDEPEND+=" + >=app-text/asciidoc-8.6.8 + dev-libs/libxslt + app-text/docbook-xsl-stylesheets + app-alternatives/yacc +" + +PATCHES=( + "${FILESDIR}/${PN}-1.1.9-remove-asciidoctor-from-config.patch" + "${FILESDIR}/${PN}-1.2.2-logrotate.patch" + "${FILESDIR}/${PN}-1.2.4-pep517-no-egg.patch" +) + +WAF_BINARY="${S}/waf" + +src_unpack() { + if [[ ${PV} == 9999 ]] ; then + git-r3_src_unpack + elif use verify-sig ; then + # Needed for downloaded waf which is unsigned + verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc} + fi + + default +} + +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 +} + +src_configure() { + filter-lto + + local string_127="" + local rclocks=""; + local CLOCKSTRING="" + + for refclock in ${NTPSEC_REFCLOCK[@]} ; do + if use ${refclock} ; then + string_127+="$refclock," + fi + done + CLOCKSTRING="`echo ${string_127}|sed 's|,$||'`" + + myconf=( + --notests + --nopyc + --nopyo + --refclock="${CLOCKSTRING}" + #--build-epoch="$(date +%s)" + $(use doc || echo "--disable-doc") + $(use early && echo "--enable-early-droproot") + $(use samba && echo "--enable-mssntp") + $(use seccomp && echo "--enable-seccomp") + $(use smear && echo "--enable-leap-smear") + $(use debug && echo "--enable-debug") + ) + python_setup + cp -v "${FILESDIR}/flit.toml" "pylib/pyproject.toml" || die + waf-utils_src_configure "${myconf[@]}" +} + +src_compile() { + waf-utils_src_compile --notests + + ln -svf pylib build/main/ntp || die + cd build/main || die + distutils-r1_src_compile +} + +src_test() { + cd build/main || die + distutils-r1_src_test +} + +python_test() { + "${EPYTHON}" "${WAF_BINARY}" check -v -j $(makeopts_jobs) || die +} + +src_install() { + # Install heat generating scripts + use heat && dosbin "${S}"/contrib/ntpheat{,usb} + + # Install the openrc files + newinitd "${FILESDIR}"/ntpd.rc-r3 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 logrotate 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 + + ln -svf pylib build/main/ntp || die + distutils-r1_src_install + waf-utils_src_install --notests + python_fix_shebang "${ED}" + python_optimize +} + +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." +}
