pkgsrc-Changes archive

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

CVS commit: pkgsrc/time/ntpsec



Module Name:    pkgsrc
Committed By:   tnn
Date:           Mon Mar 25 15:40:35 UTC 2019

Added Files:
        pkgsrc/time/ntpsec: DESCR Makefile PLIST distinfo
        pkgsrc/time/ntpsec/files: ntpd.sh
        pkgsrc/time/ntpsec/patches: patch-pylib_poly.py patch-wafhelpers_waf.py
            patch-wscript

Log Message:
ntpsec: import ntpsec-1.1.3

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


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/time/ntpsec/DESCR pkgsrc/time/ntpsec/Makefile \
    pkgsrc/time/ntpsec/PLIST pkgsrc/time/ntpsec/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/time/ntpsec/files/ntpd.sh
cvs rdiff -u -r0 -r1.1 pkgsrc/time/ntpsec/patches/patch-pylib_poly.py \
    pkgsrc/time/ntpsec/patches/patch-wafhelpers_waf.py \
    pkgsrc/time/ntpsec/patches/patch-wscript

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/time/ntpsec/DESCR
diff -u /dev/null pkgsrc/time/ntpsec/DESCR:1.1
--- /dev/null   Mon Mar 25 15:40:35 2019
+++ pkgsrc/time/ntpsec/DESCR    Mon Mar 25 15:40:35 2019
@@ -0,0 +1,2 @@
+A secure, hardened, and improved implementation of Network Time Protocol
+derived from NTP Classic, Dave Mills's original.
Index: pkgsrc/time/ntpsec/Makefile
diff -u /dev/null pkgsrc/time/ntpsec/Makefile:1.1
--- /dev/null   Mon Mar 25 15:40:35 2019
+++ pkgsrc/time/ntpsec/Makefile Mon Mar 25 15:40:35 2019
@@ -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"
Index: pkgsrc/time/ntpsec/PLIST
diff -u /dev/null pkgsrc/time/ntpsec/PLIST:1.1
--- /dev/null   Mon Mar 25 15:40:35 2019
+++ pkgsrc/time/ntpsec/PLIST    Mon Mar 25 15:40:35 2019
@@ -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
Index: pkgsrc/time/ntpsec/distinfo
diff -u /dev/null pkgsrc/time/ntpsec/distinfo:1.1
--- /dev/null   Mon Mar 25 15:40:35 2019
+++ pkgsrc/time/ntpsec/distinfo Mon Mar 25 15:40:35 2019
@@ -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

Index: pkgsrc/time/ntpsec/files/ntpd.sh
diff -u /dev/null pkgsrc/time/ntpsec/files/ntpd.sh:1.1
--- /dev/null   Mon Mar 25 15:40:35 2019
+++ pkgsrc/time/ntpsec/files/ntpd.sh    Mon Mar 25 15:40:35 2019
@@ -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"

Index: pkgsrc/time/ntpsec/patches/patch-pylib_poly.py
diff -u /dev/null pkgsrc/time/ntpsec/patches/patch-pylib_poly.py:1.1
--- /dev/null   Mon Mar 25 15:40:35 2019
+++ pkgsrc/time/ntpsec/patches/patch-pylib_poly.py      Mon Mar 25 15:40:35 2019
@@ -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)
Index: pkgsrc/time/ntpsec/patches/patch-wafhelpers_waf.py
diff -u /dev/null pkgsrc/time/ntpsec/patches/patch-wafhelpers_waf.py:1.1
--- /dev/null   Mon Mar 25 15:40:35 2019
+++ pkgsrc/time/ntpsec/patches/patch-wafhelpers_waf.py  Mon Mar 25 15:40:35 2019
@@ -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):
Index: pkgsrc/time/ntpsec/patches/patch-wscript
diff -u /dev/null pkgsrc/time/ntpsec/patches/patch-wscript:1.1
--- /dev/null   Mon Mar 25 15:40:35 2019
+++ pkgsrc/time/ntpsec/patches/patch-wscript    Mon Mar 25 15:40:35 2019
@@ -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),
+     )
+     for (s, h, r) in structures:
+-        ctx.check_cc(type_name=s, header_name=h, mandatory=r)
+-
+-    # waf's SNIP_FIELD should likely include this header itself
+-    # This is needed on some systems to get size_t for following checks
+-    ctx.check_cc(auto_add_header_name=True,
+-                 header_name="stddef.h",
+-                 define_name="",           # omit from config.h
+-                 mandatory=False)
++        ctx.check_cc(
++            fragment=to_header(h) + SNIP_TYPE % {'type_name': s},
++            msg='Checking for type %s' % s,
++            define_name=ctx.have_define(s.upper()),
++            mandatory=r,
++        )
+ 
+     structure_fields = (
+         ("struct timex", "time_tick", ["sys/time.h", "sys/timex.h"]),
+@@ -582,7 +595,12 @@ int main(int argc, char **argv) {
+         # first in glibc 2.12
+     )
+     for (s, f, h) in structure_fields:
+-        ctx.check_cc(type_name=s, field_name=f, header_name=h, mandatory=False)
++        ctx.check_cc(
++            fragment=to_header(h) + SNIP_FIELD % {'type_name': s, 'field_name': f},
++            msg='Checking for field %s in %s' % (f, s),
++            define_name=ctx.have_define((s + '_' + f).upper()),
++            mandatory=False,
++        )
+ 
+     # mostly used by timetoa.h and timespecops.h
+     sizeofs = [



Home | Main Index | Thread Index | Old Index