Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/chrony/
Date: Thu, 27 Aug 2020 07:05:13
Message-Id: 1598511907.ae893da994a6087739546349e5b168e5ef1d8244.jer@gentoo
1 commit: ae893da994a6087739546349e5b168e5ef1d8244
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 27 06:56:28 2020 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 27 07:05:07 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae893da9
7
8 net-misc/chrony: Version 4.0_pre3
9
10 Package-Manager: Portage-3.0.4, Repoman-3.0.1
11 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
12
13 net-misc/chrony/Manifest | 1 +
14 net-misc/chrony/chrony-4.0_pre3.ebuild | 198 +++++++++++++++++++++++++++++++++
15 2 files changed, 199 insertions(+)
16
17 diff --git a/net-misc/chrony/Manifest b/net-misc/chrony/Manifest
18 index 5920dce58e8..92cf28dc159 100644
19 --- a/net-misc/chrony/Manifest
20 +++ b/net-misc/chrony/Manifest
21 @@ -1,3 +1,4 @@
22 DIST chrony-3.5.1.tar.gz 459902 BLAKE2B 503402c0dd68a340eb5ecd8b57dcb83d90124f31e8deb6e20bd1e9ed19b5dc952fa7f40a697d0d0cb77c349c9f3297dcd32265d77670a71836ba8709dcc83053 SHA512 489cf614bfb2c1e024343af1316c339b287ed5c7b6cec15b44ef3d90512036fb1da3fd627d291a193c59d9c5c095afa66c529eeb6fd0c1bbc8256ed8873b7984
23 DIST chrony-3.5.tar.gz 458226 BLAKE2B 611f21e36c6e745208e00eba988519fcd912c6c0c3518c953591f43224dc3da79f627027a6cd4bf9c4227e9f8659a69adbdb634252ff3920d2ef677e32012456 SHA512 c4f6376a44d71b6ac2b6d86e3d6fb4348642faeef7f3f3a4d6431627b5645efcc868b005cc398c8292bc3b63a1161fbd1a042c6ac2a0595843f908fe32eed90c
24 DIST chrony-4.0-pre2.tar.gz 512765 BLAKE2B bfcac8564b05ed3cb6a67230746ec83d3f00192bd1d5e623ee12068bf3b7ca55e169a0228a13b62339be6a1c237199cd73186b1962ba51b445a56040560917fb SHA512 be3ca7c57c62c9ecf8d20d0b8d7b5a34ac455fb333be0587eabd5dfd7eebbcb3a3601ad161554a62098a9ca8d6530bee2900e9e7476bf477c3cb11907091dbd2
25 +DIST chrony-4.0-pre3.tar.gz 539117 BLAKE2B f26fcac8e29322151251e60b385a815c53155f163d7ed1e1269f90f3418c59ec8f4952b1bba1203549607c63bb373cbaab17af933e02e659eced91827519bc6b SHA512 e52f2454b0cbe60ab7c8975deba499f1ff2e84cd1c3d0a0fb208f11f12ca762f2d0cd74af7aacc8022e628cdeaa4ac388fdd134715cc3e274b3818d5c12da460
26
27 diff --git a/net-misc/chrony/chrony-4.0_pre3.ebuild b/net-misc/chrony/chrony-4.0_pre3.ebuild
28 new file mode 100644
29 index 00000000000..5535a1b2ea7
30 --- /dev/null
31 +++ b/net-misc/chrony/chrony-4.0_pre3.ebuild
32 @@ -0,0 +1,198 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +inherit systemd tmpfiles toolchain-funcs
38 +
39 +DESCRIPTION="NTP client and server programs"
40 +HOMEPAGE="https://chrony.tuxfamily.org/"
41 +
42 +if [[ ${PV} == "9999" ]]; then
43 + EGIT_REPO_URI="https://git.tuxfamily.org/chrony/chrony.git"
44 +
45 + inherit git-r3
46 +else
47 + SRC_URI="https://download.tuxfamily.org/${PN}/${P/_/-}.tar.gz"
48 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
49 +fi
50 +
51 +LICENSE="GPL-2"
52 +SLOT="0"
53 +
54 +IUSE="
55 + +adns +caps +cmdmon html ipv6 libedit +nettle +ntp +phc pps readline +refclock +rtc
56 + +seccomp +sechash selinux
57 +"
58 +
59 +REQUIRED_USE="
60 + ?? ( libedit readline )
61 + sechash? ( nettle )
62 +"
63 +
64 +RESTRICT=test
65 +
66 +BDEPEND=""
67 +
68 +CDEPEND="
69 + caps? ( acct-group/ntp acct-user/ntp sys-libs/libcap )
70 + libedit? ( dev-libs/libedit )
71 + nettle? ( dev-libs/nettle:= )
72 + readline? ( >=sys-libs/readline-4.1-r4:= )
73 + seccomp? ( sys-libs/libseccomp )
74 +"
75 +
76 +DEPEND="
77 + ${CDEPEND}
78 + html? ( dev-ruby/asciidoctor )
79 + pps? ( net-misc/pps-tools )
80 +"
81 +
82 +RDEPEND="
83 + ${CDEPEND}
84 + selinux? ( sec-policy/selinux-chronyd )
85 +"
86 +
87 +if [[ ${PV} == "9999" ]]; then
88 + BDEPEND+=" virtual/w3m"
89 +fi
90 +
91 +S="${WORKDIR}/${P/_/-}"
92 +
93 +PATCHES=(
94 + "${FILESDIR}"/${PN}-3.5-pool-vendor-gentoo.patch
95 + "${FILESDIR}"/${PN}-3.5-r3-systemd-gentoo.patch
96 +)
97 +
98 +src_prepare() {
99 + default
100 +
101 + sed -i \
102 + -e 's:/etc/chrony\.conf:/etc/chrony/chrony.conf:g' \
103 + doc/* examples/* || die
104 +
105 + # Copy for potential user fixup
106 + cp "${FILESDIR}"/chronyd.conf-r1 "${T}"/chronyd.conf
107 + cp examples/chronyd.service "${T}"/chronyd.service
108 +}
109 +
110 +src_configure() {
111 +
112 + # Set config for privdrop
113 + if ! use caps; then
114 + sed -i \
115 + -e 's/-u ntp//' \
116 + "${T}"/chronyd.conf "${T}"/chronyd.service || die
117 + fi
118 +
119 + if ! use seccomp; then
120 + sed -i \
121 + -e 's/-F 1//' \
122 + "${T}"/chronyd.conf "${T}"/chronyd.service || die
123 + fi
124 + tc-export CC
125 +
126 + local CHRONY_EDITLINE
127 + # ./configure legend:
128 + # --disable-readline : disable line editing entirely
129 + # --without-readline : do not use sys-libs/readline (enabled by default)
130 + # --without-editline : do not use dev-libs/libedit (enabled by default)
131 + if ! use readline && ! use libedit; then
132 + CHRONY_EDITLINE='--disable-readline'
133 + else
134 + CHRONY_EDITLINE+=" $(usex readline '' --without-readline)"
135 + CHRONY_EDITLINE+=" $(usex libedit '' --without-editline)"
136 + fi
137 +
138 + # not an autotools generated script
139 + local myconf=(
140 + $(use_enable seccomp scfilter)
141 + $(usex adns '' --disable-asyncdns)
142 + $(usex caps '' --disable-linuxcaps)
143 + $(usex cmdmon '' --disable-cmdmon)
144 + $(usex ipv6 '' --disable-ipv6)
145 + $(usex nettle '' --without-nettle)
146 + $(usex ntp '' --disable-ntp)
147 + $(usex phc '' --disable-phc)
148 + $(usex pps '' --disable-pps)
149 + $(usex refclock '' --disable-refclock)
150 + $(usex rtc '' --disable-rtc)
151 + $(usex sechash '' --disable-sechash)
152 + ${CHRONY_EDITLINE}
153 + ${EXTRA_ECONF}
154 + --chronysockdir="${EPREFIX}/run/chrony"
155 + --docdir="${EPREFIX}/usr/share/doc/${PF}"
156 + --mandir="${EPREFIX}/usr/share/man"
157 + --prefix="${EPREFIX}/usr"
158 + --sysconfdir="${EPREFIX}/etc/chrony"
159 + --with-pidfile="${EPREFIX}/run/chrony/chronyd.pid"
160 + --without-nss
161 + --without-tomcrypt
162 + )
163 +
164 + # print the ./configure call to aid in future debugging
165 + echo bash ./configure "${myconf[@]}" >&2
166 + bash ./configure "${myconf[@]}" || die
167 +}
168 +
169 +src_compile() {
170 + if [[ ${PV} == "9999" ]]; then
171 + # uses w3m
172 + emake -C doc man txt
173 + fi
174 +
175 + emake all docs $(usex html '' 'ADOC=true')
176 +}
177 +
178 +src_install() {
179 + default
180 +
181 + newinitd "${FILESDIR}"/chronyd.init-r2 chronyd
182 + newconfd "${T}"/chronyd.conf chronyd
183 +
184 + insinto /etc/${PN}
185 + newins examples/chrony.conf.example1 chrony.conf
186 +
187 + docinto examples
188 + dodoc examples/*.example*
189 +
190 + newtmpfiles - chronyd.conf <<<"d /run/chrony 0750 $(usex caps 'ntp ntp' 'root root')"
191 +
192 + if use html; then
193 + docinto html
194 + dodoc doc/*.html
195 + fi
196 +
197 + keepdir /var/{lib,log}/chrony
198 +
199 + if use caps; then
200 + # Prepare a directory for the chrony.drift file (a la ntpsec)
201 + # Ensures the environment is sane on new installs
202 + fowners ntp:ntp /var/{lib,log}/chrony
203 + fperms 770 /var/lib/chrony
204 + fi
205 +
206 + insinto /etc/logrotate.d
207 + newins "${FILESDIR}"/chrony-2.4-r1.logrotate chrony
208 +
209 + systemd_dounit "${T}"/chronyd.service
210 + systemd_dounit examples/chrony-wait.service
211 + systemd_enable_ntpunit 50-chrony chronyd.service
212 +}
213 +
214 +pkg_preinst() {
215 + HAD_CAPS=false
216 +
217 + if has_version 'net-misc/chrony[caps]'; then
218 + HAD_CAPS=true
219 + fi
220 +}
221 +
222 +pkg_postinst() {
223 + tmpfiles_process chronyd.conf
224 +
225 + if [[ -n ${REPLACING_VERSIONS} ]] && use caps && ! ${HAD_CAPS}; then
226 + ewarn "Please adjust permissions on ${EROOT}/var/{lib,log}/chrony to be owned by ntp:ntp"
227 + ewarn "e.g. chown -R ntp:ntp ${EROOT}/var/{lib,log}/chrony"
228 + ewarn "This is necessary for chrony to drop privileges"
229 + fi
230 +}