pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/time/ntpsec ntpsec: import ntpsec-1.1.3



details:   https://anonhg.NetBSD.org/pkgsrc/rev/aeb1804575d6
branches:  trunk
changeset: 331825:aeb1804575d6
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Mon Mar 25 15:40:35 2019 +0000

description:
ntpsec: import ntpsec-1.1.3

A secure, hardened, and improved implementation of Network Time Protocol
derived from NTP Classic, Dave Mills's original.

diffstat:

 time/ntpsec/DESCR                           |   2 +
 time/ntpsec/Makefile                        |  43 ++++++++++++
 time/ntpsec/PLIST                           |  41 ++++++++++++
 time/ntpsec/distinfo                        |   9 ++
 time/ntpsec/files/ntpd.sh                   |  68 ++++++++++++++++++++
 time/ntpsec/patches/patch-pylib_poly.py     |  19 +++++
 time/ntpsec/patches/patch-wafhelpers_waf.py |  23 ++++++
 time/ntpsec/patches/patch-wscript           |  96 +++++++++++++++++++++++++++++
 8 files changed, 301 insertions(+), 0 deletions(-)

diffs (truncated from 333 to 300 lines):

diff -r fc9f83caecb7 -r aeb1804575d6 time/ntpsec/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/ntpsec/DESCR Mon Mar 25 15:40:35 2019 +0000
@@ -0,0 +1,2 @@
+A secure, hardened, and improved implementation of Network Time Protocol
+derived from NTP Classic, Dave Mills's original.
diff -r fc9f83caecb7 -r aeb1804575d6 time/ntpsec/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/ntpsec/Makefile      Mon Mar 25 15:40:35 2019 +0000
@@ -0,0 +1,43 @@
+# $NetBSD: Makefile,v 1.1 2019/03/25 15:40:35 tnn Exp $
+
+DISTNAME=      ntpsec-1.1.3
+CATEGORIES=    time
+MASTER_SITES=  http://ftp.ntpsec.org/pub/releases/
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=      ftp://ftp.ntpsec.org/pub/releases/
+COMMENT=       Hardened & improved NTP implementation derived from NTP Classic
+LICENSE=       cc-by-v4.0 AND 2-clause-bsd AND modified-bsd AND mit
+
+DEPENDS+=      ${PYPKGPREFIX}-curses-[0-9]*:../../devel/py-curses
+
+BUILD_DEPENDS+=        asciidoc-[0-9]*:../../textproc/asciidoc
+BUILD_DEPENDS+=        waf-[0-9]*:../../devel/waf
+
+USE_TOOLS+=            bison m4 pkg-config
+WAF_CONFIGURE_ARGS+=   --python=${PYTHONBIN}
+# pkgsrc python PLIST logic expects all python-3.x extensions to use -O1,
+# but I can't figure out how to pass it through waf, so disable precompiled
+# python files for now ...
+WAF_CONFIGURE_ARGS+=   --nopyc --nopyo
+WAF_CONFIGURE_ARGS+=   --refclock=all
+WAF_ENV+=              PYTHON_CONFIG=${PYTHONCONFIG}
+WAF_ENV+=              BIN_A2X=${PREFIX}/bin/a2x
+WAF_ENV+=              BIN_XSLTPROC=${PREFIX}/bin/xsltproc
+
+RCD_SCRIPTS=           ntpd
+REPLACE_PYTHON+=       ntpclients/*.py
+PY_PATCHPLIST=         yes
+
+# kludge for waf-2.x; fixed upstream already. see patch-wafhelpers_waf.py.
+CFLAGS+=       -I../../build -I../../include
+
+.include "../../devel/waf/waf.mk"
+# ntploggps(1) needs py-gps. But gpsd package in pkgsrc is too old.
+#.include "../../geography/gpsd/buildlink3.mk"
+.include "../../lang/python/application.mk"
+.include "../../lang/python/extension.mk"
+.include "../../security/openssl/buildlink3.mk"
+BUILDLINK_DEPMETHOD.libxslt?=  build
+.include "../../textproc/libxslt/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r fc9f83caecb7 -r aeb1804575d6 time/ntpsec/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/ntpsec/PLIST Mon Mar 25 15:40:35 2019 +0000
@@ -0,0 +1,41 @@
+@comment $NetBSD: PLIST,v 1.1 2019/03/25 15:40:35 tnn Exp $
+bin/ntpdig
+bin/ntpfrob
+bin/ntpkeygen
+bin/ntpleapfetch
+bin/ntplogtemp
+bin/ntpmon
+bin/ntpq
+bin/ntpsnmpd
+bin/ntpsweep
+bin/ntptime
+bin/ntptrace
+bin/ntpviz
+bin/ntpwait
+${PYSITELIB}/ntp/__init__.py
+${PYSITELIB}/ntp/agentx.py
+${PYSITELIB}/ntp/agentx_packet.py
+${PYSITELIB}/ntp/control.py
+${PYSITELIB}/ntp/magic.py
+${PYSITELIB}/ntp/ntpc.so
+${PYSITELIB}/ntp/packet.py
+${PYSITELIB}/ntp/poly.py
+${PYSITELIB}/ntp/statfiles.py
+${PYSITELIB}/ntp/util.py
+man/man1/ntpdig.1
+man/man1/ntplogtemp.1
+man/man1/ntpmon.1
+man/man1/ntpq.1
+man/man1/ntpsweep.1
+man/man1/ntptrace.1
+man/man1/ntpviz.1
+man/man5/ntp.conf.5
+man/man5/ntp.keys.5
+man/man8/ntpd.8
+man/man8/ntpfrob.8
+man/man8/ntpkeygen.8
+man/man8/ntpleapfetch.8
+man/man8/ntpsnmpd.8
+man/man8/ntptime.8
+man/man8/ntpwait.8
+sbin/ntpd
diff -r fc9f83caecb7 -r aeb1804575d6 time/ntpsec/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/ntpsec/distinfo      Mon Mar 25 15:40:35 2019 +0000
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1 2019/03/25 15:40:35 tnn Exp $
+
+SHA1 (ntpsec-1.1.3.tar.gz) = 221300deec696ad63c1540fec49b72046b2654f0
+RMD160 (ntpsec-1.1.3.tar.gz) = cdaae8f682cd4cc97a37d86aca1d3196cfea0437
+SHA512 (ntpsec-1.1.3.tar.gz) = df60c5fa63d4c94529ba1e8b21c7d6b5d0c9fb810ed7546a621b072725a6ff03edbd2dcbc3baf19ac3b3a9b82d7aff3ddee4ab8c93559b7065ed06a211b538c4
+Size (ntpsec-1.1.3.tar.gz) = 2462330 bytes
+SHA1 (patch-pylib_poly.py) = 90694c1ef806e87e74628c820659ffad26580b26
+SHA1 (patch-wafhelpers_waf.py) = 9c87a5ebac7b94f5d956abf92ceb52ffa49626c8
+SHA1 (patch-wscript) = 8ddb7b542f6ad805f49a94f5ceb7c80117529609
diff -r fc9f83caecb7 -r aeb1804575d6 time/ntpsec/files/ntpd.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/ntpsec/files/ntpd.sh Mon Mar 25 15:40:35 2019 +0000
@@ -0,0 +1,68 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: ntpd.sh,v 1.1 2019/03/25 15:40:35 tnn Exp $
+#
+
+# PROVIDE: ntpd
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+# KEYWORD: chrootdir
+
+. /etc/rc.subr
+
+name="ntpd"
+rcvar=$name
+command="@PREFIX@/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+start_precmd="ntpd_precmd"
+required_files="@PKG_SYSCONFDIR@/ntp.conf"
+
+ntpd_precmd()
+{
+       if [ -z "$ntpd_chrootdir" ]; then
+               return 0;
+       fi
+
+       # If running in a chroot cage, ensure that the appropriate files
+       # exist inside the cage, as well as helper symlinks into the cage 
+       # from outside.
+       #
+       # As this is called after the is_running and required_dir checks
+       # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir}
+       # exists and ntpd isn't running at this point (unless forcestart
+       # is used).
+       #
+       # Before enabling ntpd_chrootdir, ensure that:
+       #       - The kernel has "pseudo-device clockctl" compiled in
+       #       - /dev/clockctl is present
+       #       - This is only for NetBSD at this time.
+       #
+       if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then
+               rm -f "${ntpd_chrootdir}/dev/clockctl"
+               ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
+       fi
+       ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
+
+       if [ ! -d "${ntpd_chrootdir}/etc" ]; then
+               mkdir "${ntpd_chrootdir}/etc"
+       fi
+       if [ ! -f "${ntpd_chrootdir}/etc/services" ]; then
+               (echo "ntp              123/udp"
+                echo "ntp              123/tcp") \
+                       > "${ntpd_chrootdir}/etc/services"
+       fi
+       if [ ! -d "${ntpd_chrootdir}/var/db" ]; then
+               mkdir -p "${ntpd_chrootdir}/var/db"
+       fi
+       if [ ! -f "${ntpd_chrootdir}/var/db/services.cdb" ]; then
+               services_mkdb -o "${ntpd_chrootdir}/var/db/services.cdb" \
+                       "${ntpd_chrootdir}/etc/services"
+       fi
+
+       #       Change run_rc_commands()'s internal copy of $ntpd_flags
+       #
+       rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff -r fc9f83caecb7 -r aeb1804575d6 time/ntpsec/patches/patch-pylib_poly.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/ntpsec/patches/patch-pylib_poly.py   Mon Mar 25 15:40:35 2019 +0000
@@ -0,0 +1,19 @@
+$NetBSD: patch-pylib_poly.py,v 1.1 2019/03/25 15:40:35 tnn Exp $
+
+- NetBSD fix from upstream:
+  https://gitlab.com/NTPsec/ntpsec/commit/a4453ee5a4edf87cf081fe69f5c214a8b2a82b58
+
+--- pylib/poly.py.orig 2019-01-14 05:40:59.000000000 +0000
++++ pylib/poly.py
+@@ -103,9 +103,9 @@ else:  # Python 3
+                                 newline="\n", line_buffering=True)
+ 
+     # This is the one situation where we *can* force unicode.
+-    if "UTF-8" != sys.stdout.encoding:
++    if "utf-8" != sys.stdout.encoding.lower():
+         forced_utf8 = True
+         sys.stdout = make_std_wrapper(sys.stdout)
+-    if "UTF-8" != sys.stderr.encoding:
++    if "utf-8" != sys.stderr.encoding.lower():
+         forced_utf8 = True
+         sys.stderr = make_std_wrapper(sys.stderr)
diff -r fc9f83caecb7 -r aeb1804575d6 time/ntpsec/patches/patch-wafhelpers_waf.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/ntpsec/patches/patch-wafhelpers_waf.py       Mon Mar 25 15:40:35 2019 +0000
@@ -0,0 +1,23 @@
+$NetBSD: patch-wafhelpers_waf.py,v 1.1 2019/03/25 15:40:35 tnn Exp $
+
+Kludge for waf 2.0. Added include paths in CFLAGS in pkgsrc Makefile instead.
+
+--- wafhelpers/waf.py.orig     2019-01-14 05:40:59.000000000 +0000
++++ wafhelpers/waf.py
+@@ -6,14 +6,14 @@ from waflib.TaskGen import before_method
+ @feature('bld_include')
+ def insert_blddir(self):
+     bldnode = self.bld.bldnode.parent.abspath()
+-    self.includes += [bldnode]
++#    self.includes += [bldnode]
+ 
+ 
+ @before_method('apply_incpaths')
+ @feature('src_include')
+ def insert_srcdir(self):
+     srcnode = self.bld.srcnode.abspath()
+-    self.includes += ["%s/include" % srcnode]
++#    self.includes += ["%s/include" % srcnode]
+ 
+ 
+ def manpage_subst_fun(self, code):
diff -r fc9f83caecb7 -r aeb1804575d6 time/ntpsec/patches/patch-wscript
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/time/ntpsec/patches/patch-wscript Mon Mar 25 15:40:35 2019 +0000
@@ -0,0 +1,96 @@
+$NetBSD: patch-wscript,v 1.1 2019/03/25 15:40:35 tnn Exp $
+
+- don't hardcode PREFIX
+- waf-2.x support from upstream:
+  https://gitlab.com/NTPsec/ntpsec/commit/ff6f50b1ce7d7c2a552b27c6e8fb19639a7bf82a
+
+--- wscript.orig       2019-01-14 05:40:59.000000000 +0000
++++ wscript
+@@ -536,20 +536,12 @@ int main(int argc, char **argv) {
+ 
+     # XXX: hack
+     if ctx.env.DEST_OS in ["freebsd", "openbsd"]:
+-        ctx.env.PLATFORM_INCLUDES = ["/usr/local/include"]
+-        ctx.env.PLATFORM_LIBPATH = ["/usr/local/lib"]
++        pass
+     elif ctx.env.DEST_OS == "netbsd":
+-        ctx.env.PLATFORM_INCLUDES = ["/usr/pkg/include"]
+-        ctx.env.PLATFORM_LIBPATH = ["/usr/lib", "/usr/pkg/lib"]
++        pass
+     elif ctx.env.DEST_OS == "win32":
+         ctx.load("msvc")
+     elif ctx.env.DEST_OS == "darwin":
+-        # macports location
+-        if os.path.isdir("/opt/local/include"):
+-            ctx.env.PLATFORM_INCLUDES = ["/opt/local/include"]
+-        if os.path.isdir("/opt/local/lib"):
+-            ctx.env.PLATFORM_LIBPATH = ["/opt/local/lib"]
+-        # OS X needs this for IPv6
+         ctx.define("__APPLE_USE_RFC_3542", 1,
+                    comment="Needed for IPv6 support")
+     elif ctx.env.DEST_OS == "sunos":
+@@ -558,6 +550,29 @@ int main(int argc, char **argv) {
+         ctx.define("_POSIX_C_SOURCE", "200112L", quote=False)
+         ctx.define("__EXTENSIONS__", "1", quote=False)
+ 
++    # Borrowed from waf-1.9, when type_name and field_name were valid keywords
++    SNIP_TYPE = '''
++    int main(int argc, char **argv) {
++        (void)argc; (void)argv;
++        if ((%(type_name)s *) 0) return 0;
++        if (sizeof (%(type_name)s)) return 0;
++        return 1;
++    }
++    '''
++
++    SNIP_FIELD = '''
++    #include <stddef.h>
++    int main(int argc, char **argv) {
++        char *off;
++        (void)argc; (void)argv;
++        off = (char*) &((%(type_name)s*)0)->%(field_name)s;
++        return (size_t) off < sizeof(%(type_name)s);
++    }
++    '''
++
++    def to_header(header_name):
++        return ''.join(['#include <%s>\n' % x for x in Utils.to_list(header_name)])
++
+     structures = (
+         ("struct if_laddrconf", ["sys/types.h", "net/if6.h"], False),
+         ("struct if_laddrreq", ["sys/types.h", "net/if6.h"], False),
+@@ -565,14 +580,12 @@ int main(int argc, char **argv) {
+         ("struct ntptimeval", ["sys/time.h", "sys/timex.h"], False),



Home | Main Index | Thread Index | Old Index