Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/ntp/files/, net-misc/ntp/
Date: Sun, 07 May 2017 07:27:33
Message-Id: 1494141500.5a5419a9ce62e34b4def43afecb274bcb61ad627.whissi@gentoo
1 commit: 5a5419a9ce62e34b4def43afecb274bcb61ad627
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 7 07:18:20 2017 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sun May 7 07:18:20 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a5419a9
7
8 net-misc/ntp: Rev bump to fix regression caused by libressl patch
9
10 LibreSSL support was silently added via commit ce3be83baf which caused
11 a regression for building ntp without SSL (see Gentoo-Bug 600668).
12
13 Acked-by: Lars Wendler <polynomial-c <AT> gentoo.org>
14 Gentoo-Bug: https://bugs.gentoo.org/600668
15 Package-Manager: Portage-2.3.5, Repoman-2.3.2
16
17 ...tp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch | 39 ++++++
18 net-misc/ntp/ntp-4.2.8_p10-r1.ebuild | 137 +++++++++++++++++++++
19 2 files changed, 176 insertions(+)
20
21 diff --git a/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch b/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch
22 new file mode 100644
23 index 00000000000..1b532c6d893
24 --- /dev/null
25 +++ b/net-misc/ntp/files/ntp-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch
26 @@ -0,0 +1,39 @@
27 +Fix building with libressl or without SSL.
28 +
29 +Origin: http://bugs.ntp.org/attachment.cgi?id=1481
30 +
31 +LibreSSL fix from Joe Kappus (https://bugs.gentoo.org/show_bug.cgi?id=600668#c2)
32 +
33 +--- a/include/libssl_compat.h
34 ++++ b/include/libssl_compat.h
35 +@@ -37,7 +37,7 @@
36 + #endif
37 +
38 + /* ----------------------------------------------------------------- */
39 +-#if OPENSSL_VERSION_NUMBER < 0x10100000L
40 ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
41 + /* ----------------------------------------------------------------- */
42 +
43 + # include <openssl/objects.h>
44 +--- a/libntp/libssl_compat.c
45 ++++ b/libntp/libssl_compat.c
46 +@@ -26,7 +26,7 @@
47 + /* ----------------------------------------------------------------- */
48 +
49 + /* ----------------------------------------------------------------- */
50 +-#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER < 0x10100000L
51 ++#if defined(OPENSSL) && (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))
52 + /* ----------------------------------------------------------------- */
53 +
54 + #include "libssl_compat.h"
55 +--- a/libntp/ssl_init.c
56 ++++ b/libntp/ssl_init.c
57 +@@ -21,7 +21,7 @@
58 +
59 + int ssl_init_done;
60 +
61 +-#if OPENSSL_VERSION_NUMBER < 0x10100000L
62 ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
63 +
64 + static void
65 + atexit_ssl_cleanup(void)
66
67 diff --git a/net-misc/ntp/ntp-4.2.8_p10-r1.ebuild b/net-misc/ntp/ntp-4.2.8_p10-r1.ebuild
68 new file mode 100644
69 index 00000000000..189cbf0cef1
70 --- /dev/null
71 +++ b/net-misc/ntp/ntp-4.2.8_p10-r1.ebuild
72 @@ -0,0 +1,137 @@
73 +# Copyright 1999-2017 Gentoo Foundation
74 +# Distributed under the terms of the GNU General Public License v2
75 +
76 +EAPI="5"
77 +
78 +inherit eutils toolchain-funcs flag-o-matic user systemd
79 +
80 +MY_P=${P/_p/p}
81 +DESCRIPTION="Network Time Protocol suite/programs"
82 +HOMEPAGE="http://www.ntp.org/"
83 +SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar.gz
84 + https://dev.gentoo.org/~polynomial-c/${MY_P}-manpages.tar.xz"
85 +
86 +LICENSE="HPND BSD ISC"
87 +SLOT="0"
88 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~m68k-mint"
89 +IUSE="caps debug ipv6 libressl openntpd parse-clocks readline samba selinux snmp ssl +threads vim-syntax zeroconf"
90 +
91 +CDEPEND="readline? ( >=sys-libs/readline-4.1:0= )
92 + >=dev-libs/libevent-2.0.9:=[threads?]
93 + kernel_linux? ( caps? ( sys-libs/libcap ) )
94 + zeroconf? ( net-dns/avahi[mdnsresponder-compat] )
95 + !openntpd? ( !net-misc/openntpd )
96 + snmp? ( net-analyzer/net-snmp )
97 + ssl? (
98 + !libressl? ( dev-libs/openssl:0= )
99 + libressl? ( dev-libs/libressl )
100 + )
101 + parse-clocks? ( net-misc/pps-tools )"
102 +DEPEND="${CDEPEND}
103 + virtual/pkgconfig"
104 +RDEPEND="${CDEPEND}
105 + selinux? ( sec-policy/selinux-ntp )
106 + vim-syntax? ( app-vim/ntp-syntax )"
107 +PDEPEND="openntpd? ( net-misc/openntpd )"
108 +
109 +S=${WORKDIR}/${MY_P}
110 +
111 +PATCHES=(
112 + "${FILESDIR}"/${PN}-4.2.8-ipc-caps.patch #533966
113 + "${FILESDIR}"/${PN}-4.2.8-sntp-test-pthreads.patch #563922
114 + "${FILESDIR}"/${PN}-4.2.8_p10-ntpq-fpic.patch
115 + "${FILESDIR}"/${PN}-4.2.8_p10-fix-build-wo-ssl-or-libressl.patch
116 +)
117 +
118 +pkg_setup() {
119 + enewgroup ntp 123
120 + enewuser ntp 123 -1 /dev/null ntp
121 +}
122 +
123 +src_prepare() {
124 + epatch "${PATCHES[@]}"
125 + append-cppflags -D_GNU_SOURCE #264109
126 + # Make sure every build uses the same install layout. #539092
127 + find sntp/loc/ -type f '!' -name legacy -delete || die
128 + # Disable pointless checks.
129 + touch .checkChangeLog .gcc-warning FRC.html html/.datecheck
130 +}
131 +
132 +src_configure() {
133 + # avoid libmd5/libelf
134 + export ac_cv_search_MD5Init=no ac_cv_header_md5_h=no
135 + export ac_cv_lib_elf_nlist=no
136 + # blah, no real configure options #176333
137 + export ac_cv_header_dns_sd_h=$(usex zeroconf)
138 + export ac_cv_lib_dns_sd_DNSServiceRegister=${ac_cv_header_dns_sd_h}
139 + # Increase the default memlimit from 32MiB to 128MiB. #533232
140 + econf \
141 + --with-lineeditlibs=readline,edit,editline \
142 + --with-yielding-select \
143 + --disable-local-libevent \
144 + --docdir='$(datarootdir)'/doc/${PF} \
145 + --htmldir='$(docdir)/html' \
146 + --with-memlock=256 \
147 + $(use_enable caps linuxcaps) \
148 + $(use_enable parse-clocks) \
149 + $(use_enable ipv6) \
150 + $(use_enable debug debugging) \
151 + $(use_with readline lineeditlibs readline) \
152 + $(use_enable samba ntp-signd) \
153 + $(use_with snmp ntpsnmpd) \
154 + $(use_with ssl crypto) \
155 + $(use_enable threads thread-support)
156 +}
157 +
158 +src_install() {
159 + default
160 + # move ntpd/ntpdate to sbin #66671
161 + dodir /usr/sbin
162 + mv "${ED}"/usr/bin/{ntpd,ntpdate} "${ED}"/usr/sbin/ || die "move to sbin"
163 +
164 + dodoc INSTALL WHERE-TO-START
165 + doman "${WORKDIR}"/man/*.[58]
166 +
167 + insinto /etc
168 + doins "${FILESDIR}"/ntp.conf
169 + use ipv6 || sed -i '/^restrict .*::1/d' "${ED}"/etc/ntp.conf #524726
170 + newinitd "${FILESDIR}"/ntpd.rc-r1 ntpd
171 + newconfd "${FILESDIR}"/ntpd.confd ntpd
172 + newinitd "${FILESDIR}"/ntp-client.rc ntp-client
173 + newconfd "${FILESDIR}"/ntp-client.confd ntp-client
174 + newinitd "${FILESDIR}"/sntp.rc sntp
175 + newconfd "${FILESDIR}"/sntp.confd sntp
176 + if ! use caps ; then
177 + sed -i "s|-u ntp:ntp||" "${ED}"/etc/conf.d/ntpd || die
178 + fi
179 + sed -i "s:/usr/bin:/usr/sbin:" "${ED}"/etc/init.d/ntpd || die
180 +
181 + keepdir /var/lib/ntp
182 + use prefix || fowners ntp:ntp /var/lib/ntp
183 +
184 + if use openntpd ; then
185 + cd "${ED}"
186 + rm usr/sbin/ntpd || die
187 + rm -r var/lib
188 + rm etc/{conf,init}.d/ntpd
189 + rm usr/share/man/*/ntpd.8 || die
190 + else
191 + systemd_newunit "${FILESDIR}"/ntpd.service-r2 ntpd.service
192 + use caps && sed -i '/ExecStart/ s|$| -u ntp:ntp|' "${ED}"/usr/lib/systemd/system/ntpd.service
193 + systemd_enable_ntpunit 60-ntpd ntpd.service
194 + fi
195 +
196 + systemd_newunit "${FILESDIR}"/ntpdate.service-r1 ntpdate.service
197 + systemd_install_serviced "${FILESDIR}"/ntpdate.service.conf
198 + systemd_newunit "${FILESDIR}"/sntp.service-r2 sntp.service
199 + systemd_install_serviced "${FILESDIR}"/sntp.service.conf
200 +}
201 +
202 +pkg_postinst() {
203 + if grep -qs '^[^#].*notrust' "${EROOT}"/etc/ntp.conf ; then
204 + eerror "The notrust option was found in your /etc/ntp.conf!"
205 + ewarn "If your ntpd starts sending out weird responses,"
206 + ewarn "then make sure you have keys properly setup and see"
207 + ewarn "https://bugs.gentoo.org/41827"
208 + fi
209 +}