pkgsrc-Bugs archive

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

Re: pkg/49582: Update to net/openntpd 5.7p1



At Sun, 18 Jan 2015 06:35:01 +0000 (UTC), David Holland wrote:
>   > >Synopsis:       Update to net/openntpd 5.7p1
>  
>  Can someone reconcile this and the other update posted in PR 49583?

I was surprised.

A part of PR 49583 was merged.

(SMF is not understand well, so I am not merging.)

* remove openssl buildlink3.mk.
* more use SUBST framework.
* ntpd.drift dir: /var/db -> /var/db/opennntpd
* patch-ntpd.c.


diff -uNr openntpd/Makefile openntpd.new/Makefile
--- openntpd/Makefile	2015-01-18 03:42:47.000000000 +0900
+++ openntpd.new/Makefile	2015-01-18 21:46:04.000000000 +0900
@@ -1,7 +1,6 @@
 # $NetBSD: Makefile,v 1.36 2015/01/17 05:51:43 obache Exp $
 
-DISTNAME=		openntpd-3.9p1
-PKGREVISION=		5
+DISTNAME=		openntpd-5.7p1
 CATEGORIES=		net
 MASTER_SITES=		${MASTER_SITE_OPENBSD:=OpenNTPD/}
 
@@ -11,8 +10,11 @@
 
 CONFLICTS+=		ntp-[0-9]*
 
+USE_TOOLS+=		automake
+
 GNU_CONFIGURE=		yes
-CONFIGURE_ARGS+=	sysconfdir=${PKG_SYSCONFDIR:Q}
+CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR:Q}
+CONFIGURE_ARGS+=	--localstatedir=${VARBASE}
 
 EGDIR=			${PREFIX}/share/examples/openntpd
 CONF_FILES=		${EGDIR}/ntpd.conf ${PKG_SYSCONFDIR}/ntpd.conf
@@ -24,16 +26,35 @@
 
 BUILD_DEFS+=		VARBASE
 
-OWN_DIRS=		${VARBASE}/chroot/ntpd
+OWN_DIRS=		${VARBASE}/chroot/ntpd ${VARBASE}/db/openntpd
 AUTO_MKDIRS=		yes
 
 INSTALLATION_DIRS+=	sbin ${PKGMANDIR}/man5 ${PKGMANDIR}/man8 ${EGDIR}
 
+SUBST_CLASSES+=			patch_m
+SUBST_MESSAGE.patch_m=	Adjusting path.
+SUBST_STAGE.patch_m=	pre-build
+SUBST_FILES.patch_m=	ntpd.8 ntpctl.8 ntpd.conf.8
+SUBST_SED.patch_m=		-e "s,/etc/ntp.conf,${PKG_SYSCONFDIR}/ntp.conf,g"
+SUBST_SED.patch_m=		-e 's,/var/db/,${VARBASE}/db/openntpd/,g'
+SUBST_SED.patch_m+=		-e 's,/var/run/,${VARBASE}/run/,g'
+
+SUBST_CLASSES+=			patch_h
+SUBST_MESSAGE.patch_h=	Adjusting path.
+SUBST_STAGE.ntpd_h=		pre-build
+SUBST_FILES.ntpd_h=		ntpd.h
+SUBST_SED.ntpd_h=		-e 's,/db/ntpd.drift,/db/openntpd/ntpd.drift,g'
+
+pre-configure:
+	set -e; cd ${WRKSRC}; \
+	aclocal; automake -a --foreign -i; autoconf
+
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/ntpd ${DESTDIR}${PREFIX}/sbin/ntpd
 	${INSTALL_MAN} ${WRKSRC}/ntpd.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8/ntpd.8
 	${INSTALL_MAN} ${WRKSRC}/ntpd.conf.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5/ntpd.conf.5
 	${INSTALL_DATA} ${WRKSRC}/ntpd.conf ${DESTDIR}${EGDIR}/ntpd.conf
+	${LN} -f ${DESTDIR}${PREFIX}/sbin/ntpd ${DESTDIR}${PREFIX}/sbin/ntpctl
+	${INSTALL_MAN} ${WRKSRC}/ntpctl.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8/ntpctl.8
 
-.include "../../security/openssl/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff -uNr openntpd/PLIST openntpd.new/PLIST
--- openntpd/PLIST	2014-03-15 21:08:49.000000000 +0900
+++ openntpd.new/PLIST	2015-01-18 06:02:54.000000000 +0900
@@ -1,5 +1,7 @@
-@comment $NetBSD: PLIST,v 1.4 2014/03/11 14:05:10 jperkin Exp $
+@comment $NetBSD$
 man/man5/ntpd.conf.5
+man/man8/ntpctl.8
 man/man8/ntpd.8
+sbin/ntpctl
 sbin/ntpd
 share/examples/openntpd/ntpd.conf
diff -uNr openntpd/distinfo openntpd.new/distinfo
--- openntpd/distinfo	2006-08-27 19:56:19.000000000 +0900
+++ openntpd.new/distinfo	2015-01-18 21:57:20.000000000 +0900
@@ -1,5 +1,12 @@
 $NetBSD: distinfo,v 1.7 2006/08/20 14:50:43 peter Exp $
 
-SHA1 (openntpd-3.9p1.tar.gz) = 098a435d02886a9e4d34afb15b15fde795eda1e9
-RMD160 (openntpd-3.9p1.tar.gz) = c348004116c78810daa9451f15abcc26788949a8
-Size (openntpd-3.9p1.tar.gz) = 152700 bytes
+SHA1 (openntpd-5.7p1.tar.gz) = 879972965cffbe49196b15e7d1ba680d4ca05baf
+RMD160 (openntpd-5.7p1.tar.gz) = 9b0f2924d82c3b35a1b8ee6064f6927a824917f7
+Size (openntpd-5.7p1.tar.gz) = 400113 bytes
+SHA1 (patch-Makefile.am) = f6cf754a87525c4d8c7ba0419944fc5d652c29f4
+SHA1 (patch-compat_adjfreq__netbsd.c) = 7e46af00cec686a01539d7b704a350fe220587ba
+SHA1 (patch-compat_arc4random.h) = 3acde0f8c63bb245904ebbc7820511c505982f46
+SHA1 (patch-compat_arc4random__netbsd.h) = 17d96f885a8dc70d443bd5ec34f1cd637b5d2d5e
+SHA1 (patch-compat_getentropy__netbsd.c) = b98a186675e36f91412ebc570cfa2b6cbe407070
+SHA1 (patch-configure.ac) = 7f048c5c73dd2e26094bc1743674d874aa436d7f
+SHA1 (patch-ntpd.c) = caf03e2c75d771efc177e792d8fa1d1631921d1c
diff -uNr openntpd/patches/patch-Makefile.am openntpd.new/patches/patch-Makefile.am
--- openntpd/patches/patch-Makefile.am	1970-01-01 09:00:00.000000000 +0900
+++ openntpd.new/patches/patch-Makefile.am	2015-01-18 06:51:45.000000000 +0900
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- Makefile.am.orig	2015-01-08 06:13:24.000000000 +0000
++++ Makefile.am
+@@ -122,6 +122,9 @@ if !HAVE_ADJFREQ
+ if HOST_FREEBSD
+ libcompat_la_SOURCES += compat/adjfreq_freebsd.c
+ endif
++if HOST_NETBSD
++libcompat_la_SOURCES += compat/adjfreq_netbsd.c
++endif
+ if HOST_LINUX
+ libcompat_la_SOURCES += compat/adjfreq_linux.c
+ endif
+@@ -191,6 +194,9 @@ if !HAVE_GETENTROPY
+ if HOST_FREEBSD
+ libcompat_la_SOURCES += compat/getentropy_freebsd.c
+ endif
++if HOST_NETBSD
++libcompat_la_SOURCES += compat/getentropy_netbsd.c
++endif
+ if HOST_LINUX
+ libcompat_la_SOURCES += compat/getentropy_linux.c
+ if !HAVE_SHA512
+@@ -218,6 +224,7 @@ endif
+ 
+ noinst_HEADERS = compat/arc4random.h
+ noinst_HEADERS += compat/arc4random_freebsd.h
++noinst_HEADERS += compat/arc4random_netbsd.h
+ noinst_HEADERS += compat/arc4random_linux.h
+ noinst_HEADERS += compat/arc4random_osx.h
+ noinst_HEADERS += compat/arc4random_solaris.h
diff -uNr openntpd/patches/patch-compat_adjfreq__netbsd.c openntpd.new/patches/patch-compat_adjfreq__netbsd.c
--- openntpd/patches/patch-compat_adjfreq__netbsd.c	1970-01-01 09:00:00.000000000 +0900
+++ openntpd.new/patches/patch-compat_adjfreq__netbsd.c	2015-01-18 06:51:45.000000000 +0900
@@ -0,0 +1,65 @@
+$NetBSD$
+
+--- compat/adjfreq_netbsd.c.orig	2015-01-17 21:47:21.000000000 +0000
++++ compat/adjfreq_netbsd.c
+@@ -0,0 +1,60 @@
++/*
++ * Copyright (c) 2007 Sebastian Benoit <benoit-lists%fb12.de@localhost>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <sys/types.h>
++#include <sys/time.h>
++#include <sys/timex.h>
++
++#include <unistd.h>
++
++#include "ntp.h"
++#include "ntpd.h"
++
++/*
++ * adjfreq (old)freq = nanosec. per seconds shifted left 32 bits
++ * timex.freq is ppm / left shifted by SHIFT_USEC (16 bits), defined in timex.h
++ */
++
++int
++adjfreq(const int64_t *freq, int64_t *oldfreq)
++{
++	struct timex txc;
++	int64_t newfreq;
++
++	if (freq != NULL) {
++		txc.modes = MOD_FREQUENCY;
++		txc.freq = *freq / 1e3 / (1LL << 16);
++
++		if ((ntp_adjtime(&txc)) == -1)
++			log_warn("ntp_adjtime (2) failed");
++
++		log_debug("ntp_adjtime adjusted frequency by %fppm",
++			  ((txc.freq * 1e3) *  (1LL<<16) / 1e3 / (1LL << 32)));
++	}
++	if (oldfreq != NULL) {
++		txc.modes = 0;
++		if ((ntp_adjtime(&txc)) == -1) {
++			log_warn("ntp_adjtime (1) failed");
++			return -1;
++		}
++		newfreq = (txc.freq * 1e3) *  (1LL<<16);
++		log_debug("ntp_adjtime returns frequency of %fppm",
++			  newfreq / 1e3 / (1LL << 32));
++		*oldfreq = newfreq;
++	}
++
++	return 0;
++}
diff -uNr openntpd/patches/patch-compat_arc4random.h openntpd.new/patches/patch-compat_arc4random.h
--- openntpd/patches/patch-compat_arc4random.h	1970-01-01 09:00:00.000000000 +0900
+++ openntpd.new/patches/patch-compat_arc4random.h	2015-01-18 06:51:45.000000000 +0900
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- compat/arc4random.h.orig	2015-01-08 06:13:21.000000000 +0000
++++ compat/arc4random.h
+@@ -6,6 +6,9 @@
+ #if defined(__FreeBSD__)
+ #include "arc4random_freebsd.h"
+ 
++#elif defined(__NetBSD__)
++#include "arc4random_netbsd.h"
++
+ #elif defined(__linux__)
+ #include "arc4random_linux.h"
+ 
diff -uNr openntpd/patches/patch-compat_arc4random__netbsd.h openntpd.new/patches/patch-compat_arc4random__netbsd.h
--- openntpd/patches/patch-compat_arc4random__netbsd.h	1970-01-01 09:00:00.000000000 +0900
+++ openntpd.new/patches/patch-compat_arc4random__netbsd.h	2015-01-18 06:51:45.000000000 +0900
@@ -0,0 +1,90 @@
+$NetBSD$
+
+--- compat/arc4random_netbsd.h.orig	2015-01-17 21:47:21.000000000 +0000
++++ compat/arc4random_netbsd.h
+@@ -0,0 +1,85 @@
++/*	$OpenBSD: arc4random_freebsd.h,v 1.1 2014/07/20 20:51:13 bcook Exp $	*/
++
++/*
++ * Copyright (c) 1996, David Mazieres <dm%uun.org@localhost>
++ * Copyright (c) 2008, Damien Miller <djm%openbsd.org@localhost>
++ * Copyright (c) 2013, Markus Friedl <markus%openbsd.org@localhost>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++/*
++ * Stub functions for portability.
++ */
++
++#include <sys/mman.h>
++
++#include <pthread.h>
++#include <signal.h>
++
++static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
++#define _ARC4_LOCK()   pthread_mutex_lock(&arc4random_mtx)
++#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
++
++/*
++ * Unfortunately, pthread_atfork() is broken on FreeBSD (at least 9 and 10) if
++ * a program does not link to -lthr. Callbacks registered with pthread_atfork()
++ * appear to fail silently. So, it is not always possible to detect a PID
++ * wraparound.
++ */
++#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
++
++static inline void
++_getentropy_fail(void)
++{
++	raise(SIGKILL);
++}
++
++static volatile sig_atomic_t _rs_forked;
++
++static inline void
++_rs_forkhandler(void)
++{
++	_rs_forked = 1;
++}
++
++static inline void
++_rs_forkdetect(void)
++{
++	static pid_t _rs_pid = 0;
++	pid_t pid = getpid();
++
++	if (_rs_pid == 0 || _rs_pid != pid || _rs_forked) {
++		_rs_pid = pid;
++		_rs_forked = 0;
++		if (rs)
++			memset(rs, 0, sizeof(*rs));
++	}
++}
++
++static inline int
++_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
++{
++	if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
++	    MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
++		return -1;
++
++	if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
++	    MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
++		munmap(*rsp, sizeof(**rsp));
++		return -1;
++	}
++
++	_ARC4_ATFORK(_rs_forkhandler);
++	return 0;
++}
diff -uNr openntpd/patches/patch-compat_getentropy__netbsd.c openntpd.new/patches/patch-compat_getentropy__netbsd.c
--- openntpd/patches/patch-compat_getentropy__netbsd.c	1970-01-01 09:00:00.000000000 +0900
+++ openntpd.new/patches/patch-compat_getentropy__netbsd.c	2015-01-18 06:51:45.000000000 +0900
@@ -0,0 +1,69 @@
+$NetBSD$
+
+--- compat/getentropy_netbsd.c.orig	2015-01-17 21:47:22.000000000 +0000
++++ compat/getentropy_netbsd.c
+@@ -0,0 +1,64 @@
++/*	$OpenBSD: getentropy_osx.c,v 1.7 2014/07/19 16:12:00 deraadt Exp $	*/
++
++/*
++ * Copyright (c) 2014 Pawel Jakub Dawidek <pjd%FreeBSD.org@localhost>
++ * Copyright (c) 2014 Brent Cook <bcook%openbsd.org@localhost>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ *
++ * Emulation of getentropy(2) as documented at:
++ * http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2
++ */
++
++#include <sys/types.h>
++#include <sys/sysctl.h>
++
++#include <errno.h>
++#include <stddef.h>
++
++/*
++ * Derived from lib/libc/gen/arc4random.c from FreeBSD.
++ */
++static size_t
++getentropy_sysctl(u_char *buf, size_t size)
++{
++	int mib[2];
++	size_t len, done;
++
++	mib[0] = CTL_KERN;
++	mib[1] = KERN_ARND;
++	done = 0;
++
++	do {
++		len = size;
++		if (sysctl(mib, 2, buf, &len, NULL, 0) == -1)
++			return (done);
++		done += len;
++		buf += len;
++		size -= len;
++	} while (size > 0);
++
++	return (done);
++}
++
++int
++getentropy(void *buf, size_t len)
++{
++	if (len <= 256 &&
++			getentropy_sysctl(buf, len) == len) {
++		return 0;
++	}
++
++	errno = EIO;
++	return -1;
++}
diff -uNr openntpd/patches/patch-configure.ac openntpd.new/patches/patch-configure.ac
--- openntpd/patches/patch-configure.ac	1970-01-01 09:00:00.000000000 +0900
+++ openntpd.new/patches/patch-configure.ac	2015-01-18 06:51:45.000000000 +0900
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- configure.ac.orig	2015-01-08 06:13:21.000000000 +0000
++++ configure.ac
+@@ -40,6 +40,9 @@ case $host_os in
+ 		HOST_OS=freebsd
+ 		AC_SUBST([PROG_LDADD], ['-lthr'])
+ 		;;
++	*netbsd*)
++		HOST_OS=netbsd
++		;;
+ 	*linux*)
+ 		HOST_OS=linux
+ 		CFLAGS="$CFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE"
+@@ -58,6 +61,7 @@ esac
+ 
+ AM_CONDITIONAL([HOST_DARWIN],  [test x$HOST_OS = xdarwin])
+ AM_CONDITIONAL([HOST_FREEBSD], [test x$HOST_OS = xfreebsd])
++AM_CONDITIONAL([HOST_NETBSD], [test x$HOST_OS = xnetbsd])
+ AM_CONDITIONAL([HOST_LINUX],   [test x$HOST_OS = xlinux])
+ AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris])
+ 
+@@ -137,7 +141,7 @@ AM_CONDITIONAL([HAVE_STRTONUM], [test "x
+ 
+ # overrides for arc4random_buf implementations with known issues
+ AM_CONDITIONAL([HAVE_ARC4RANDOM],
+-	[test "x$HOST_OS" != xdarwin -a "x$HOST_OS" != xfreebsd -a "x$ac_cv_func_arc4random" = xyes])
++	[test "x$HOST_OS" != xdarwin -a "x$HOST_OS" != xfreebsd -a "x$HOST_OS" != xnetbsd -a "x$ac_cv_func_arc4random" = xyes])
+ 
+ AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
+ 	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
diff -uNr openntpd/patches/patch-ntpd.c openntpd.new/patches/patch-ntpd.c
--- openntpd/patches/patch-ntpd.c	1970-01-01 09:00:00.000000000 +0900
+++ openntpd.new/patches/patch-ntpd.c	2015-01-18 21:57:13.000000000 +0900
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Generate a warning if initial time setting fails; accepted upstream.
+
+--- ntpd.c.orig	2015-01-15 02:53:35.895984392 +0000
++++ ntpd.c
+@@ -242,7 +242,7 @@ main(int argc, char *argv[])
+ 			lconf.settime = 0;
+ 			timeout = INFTIM;
+ 			log_init(lconf.debug);
+-			log_debug("no reply received in time, skipping initial "
++			log_warnx("no reply received in time, skipping initial "
+ 			    "time setting");
+ 			if (!lconf.debug) {
+ 				if (daemon(1, 0))



Home | Main Index | Thread Index | Old Index