Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-dns/dnsmasq/, net-dns/dnsmasq/files/
Date: Mon, 19 Mar 2018 18:12:07
Message-Id: 1521483098.36950876fc0da1b5ced6a6c58508f5bc2c8be572.chutzpah@gentoo
1 commit: 36950876fc0da1b5ced6a6c58508f5bc2c8be572
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Mon Mar 19 18:10:03 2018 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 19 18:11:38 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36950876
7
8 net-dns/dnsmasq: Version bump to 2.79
9
10 Closes: https://bugs.gentoo.org/586454
11 Closes: https://bugs.gentoo.org/633496
12 Closes: https://bugs.gentoo.org/643670
13 Gentoo-Bug: https://bugs.gentoo.org/645704
14 Package-Manager: Portage-2.3.24, Repoman-2.3.6
15
16 net-dns/dnsmasq/Manifest | 1 +
17 net-dns/dnsmasq/dnsmasq-2.79.ebuild | 198 +++++++++++++++++++++++++++++
18 net-dns/dnsmasq/files/dnsmasq-init-dhcp-r3 | 35 +++++
19 net-dns/dnsmasq/files/dnsmasq-init-r4 | 29 +++++
20 net-dns/dnsmasq/files/dnsmasq.logrotate | 7 +
21 5 files changed, 270 insertions(+)
22
23 diff --git a/net-dns/dnsmasq/Manifest b/net-dns/dnsmasq/Manifest
24 index 0c1296ae6cf..1a7044b3e9e 100644
25 --- a/net-dns/dnsmasq/Manifest
26 +++ b/net-dns/dnsmasq/Manifest
27 @@ -1 +1,2 @@
28 DIST dnsmasq-2.78.tar.xz 489172 BLAKE2B 996b59181c4b582b74c91be073e62f0756d2e4c67ee36ff825b6973699f60e44959bb0451bbb8623f277e5a8378cda987a300eee6ec9398ae99284b302da2747 SHA512 9b79b84e5a768d52f90f6335ccef2c404ecd7a13e78e49f4cd0755fffc6cf34d0dc96ad4c72cad1dab3c5743a8d0d789b3e9b6e625b03c5675bb898ca61a698b
29 +DIST dnsmasq-2.79.tar.xz 493036 BLAKE2B 91152c52aef06def74151f6fbae9153d25261ba5e6a728cbab503c074967963e40dce39d93a0fbe4c5497c9313ac24d495cc8233934c00d4ab82aefe83b01ccd SHA512 2c06212696ab55e1584f6133872f5b196013509e4b1822d0457787b456e14341afdde887749e370a2e512124cb4138f012f4601b08690707be4acc7cf2f2876f
30
31 diff --git a/net-dns/dnsmasq/dnsmasq-2.79.ebuild b/net-dns/dnsmasq/dnsmasq-2.79.ebuild
32 new file mode 100644
33 index 00000000000..5af2dbb6c98
34 --- /dev/null
35 +++ b/net-dns/dnsmasq/dnsmasq-2.79.ebuild
36 @@ -0,0 +1,198 @@
37 +# Copyright 1999-2018 Gentoo Foundation
38 +# Distributed under the terms of the GNU General Public License v2
39 +
40 +EAPI=6
41 +
42 +inherit toolchain-funcs flag-o-matic user systemd
43 +
44 +DESCRIPTION="Small forwarding DNS server"
45 +HOMEPAGE="http://www.thekelleys.org.uk/dnsmasq/doc.html"
46 +SRC_URI="http://www.thekelleys.org.uk/dnsmasq/${P}.tar.xz"
47 +
48 +LICENSE="|| ( GPL-2 GPL-3 )"
49 +SLOT="0"
50 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
51 +
52 +IUSE="auth-dns conntrack dbus +dhcp dhcp-tools dnssec id idn libidn2 +inotify"
53 +IUSE+=" ipv6 lua nls script selinux static tftp"
54 +
55 +DM_LINGUAS=(de es fi fr id it no pl pt_BR ro)
56 +
57 +CDEPEND="dbus? ( sys-apps/dbus )
58 + idn? (
59 + !libidn2? ( net-dns/libidn )
60 + libidn2? ( >=net-dns/libidn2-2.0 )
61 + )
62 + lua? ( dev-lang/lua:* )
63 + conntrack? ( net-libs/libnetfilter_conntrack )
64 + nls? ( sys-devel/gettext )
65 +"
66 +
67 +DEPEND="${CDEPEND}
68 + app-arch/xz-utils
69 + dnssec? (
70 + dev-libs/nettle[gmp]
71 + static? ( dev-libs/nettle[static-libs(+)] )
72 + )
73 + virtual/pkgconfig
74 +"
75 +
76 +RDEPEND="${CDEPEND}
77 + dnssec? (
78 + !static? (
79 + dev-libs/nettle[gmp]
80 + )
81 + )
82 + selinux? ( sec-policy/selinux-dnsmasq )
83 +"
84 +
85 +REQUIRED_USE="dhcp-tools? ( dhcp )
86 + lua? ( script )
87 + libidn2? ( idn )"
88 +
89 +use_have() {
90 + local useflag no_only uword
91 + if [[ $1 == '-n' ]]; then
92 + no_only=1
93 + shift
94 + fi
95 + useflag="${1}"
96 + shift
97 +
98 + uword="${1:-${useflag}}"
99 + shift
100 +
101 + while [[ ${uword} ]]; do
102 + uword="${uword^^}"
103 +
104 + if ! use "${useflag}"; then
105 + printf -- " -DNO_%s" "${uword}"
106 + elif [[ -z "${no_only}" ]]; then
107 + printf -- " -DHAVE_%s" "${uword}"
108 + fi
109 + uword="${1}"
110 + shift
111 + done
112 +}
113 +
114 +pkg_pretend() {
115 + if use static; then
116 + einfo "Only sys-libs/gmp and dev-libs/nettle are statically linked."
117 + use dnssec || einfo "Thus, ${P}[!dnssec,static] makes no sense; the static USE flag is ignored."
118 + fi
119 +}
120 +
121 +pkg_setup() {
122 + enewgroup dnsmasq
123 + enewuser dnsmasq -1 -1 /dev/null dnsmasq
124 +}
125 +
126 +src_prepare() {
127 + default
128 +
129 + sed -i -r 's:lua5.[0-9]+:lua:' Makefile
130 + sed -i "s:%%PREFIX%%:${EPREFIX}/usr:" dnsmasq.conf.example
131 +}
132 +
133 +src_configure() {
134 + COPTS="$(use_have -n auth-dns auth)"
135 + COPTS+="$(use_have conntrack)"
136 + COPTS+="$(use_have dbus)"
137 + COPTS+="$(use libidn2 || use_have idn)"
138 + COPTS+="$(use_have libidn2)"
139 + COPTS+="$(use_have -n inotify)"
140 + COPTS+="$(use_have -n dhcp dhcp dhcp6)"
141 + COPTS+="$(use_have -n ipv6 ipv6 dhcp6)"
142 + COPTS+="$(use_have -n id id)"
143 + COPTS+="$(use_have lua luascript)"
144 + COPTS+="$(use_have -n script)"
145 + COPTS+="$(use_have -n tftp)"
146 + COPTS+="$(use_have dnssec)"
147 + COPTS+="$(use_have static dnssec_static)"
148 +}
149 +
150 +src_compile() {
151 + emake \
152 + PREFIX=/usr \
153 + MANDIR=/usr/share/man \
154 + CC="$(tc-getCC)" \
155 + PKG_CONFIG="$(tc-getPKG_CONFIG)" \
156 + CFLAGS="${CFLAGS}" \
157 + LDFLAGS="${LDFLAGS}" \
158 + COPTS="${COPTS}" \
159 + CONFFILE="/etc/${PN}.conf" \
160 + all$(use nls && echo "-i18n")
161 +
162 + use dhcp-tools && emake -C contrib/lease-tools \
163 + PREFIX=/usr \
164 + MANDIR=/usr/share/man \
165 + CC="$(tc-getCC)" \
166 + PKG_CONFIG="$(tc-getPKG_CONFIG)" \
167 + CFLAGS="${CFLAGS}" \
168 + LDFLAGS="${LDFLAGS}" \
169 + all
170 +}
171 +
172 +src_install() {
173 + local lingua puid
174 + emake \
175 + PREFIX=/usr \
176 + MANDIR=/usr/share/man \
177 + COPTS="${COPTS}" \
178 + DESTDIR="${D}" \
179 + install$(use nls && echo "-i18n")
180 +
181 + for lingua in "${DM_LINGUAS[@]}"; do
182 + has ${lingua} ${LINGUAS-${lingua}} \
183 + || rm -rf "${D}"/usr/share/locale/${lingua}
184 + done
185 + [[ -d "${D}"/usr/share/locale/ ]] && rmdir --ignore-fail-on-non-empty "${D}"/usr/share/locale/
186 +
187 + dodoc CHANGELOG CHANGELOG.archive FAQ dnsmasq.conf.example
188 + dodoc -r logo
189 +
190 + docinto html/
191 + dodoc *.html
192 +
193 + newinitd "${FILESDIR}"/dnsmasq-init-r4 ${PN}
194 + newconfd "${FILESDIR}"/dnsmasq.confd-r1 ${PN}
195 +
196 + insinto /etc/logrotate.d
197 + newins "${FILESDIR}"/dnsmasq.logrotate ${PN}
198 +
199 + insinto /etc
200 + newins dnsmasq.conf.example dnsmasq.conf
201 +
202 + insinto /usr/share/dnsmasq
203 + doins trust-anchors.conf
204 +
205 + if use dhcp; then
206 + keepdir /var/lib/misc
207 + newinitd "${FILESDIR}"/dnsmasq-init-dhcp-r3 ${PN}
208 + fi
209 + if use dbus; then
210 + insinto /etc/dbus-1/system.d
211 + doins dbus/dnsmasq.conf
212 + fi
213 +
214 + if use dhcp-tools; then
215 + dosbin contrib/lease-tools/{dhcp_release,dhcp_lease_time}
216 + doman contrib/lease-tools/{dhcp_release,dhcp_lease_time}.1
217 + if use ipv6; then
218 + dosbin contrib/lease-tools/dhcp_release6
219 + doman contrib/lease-tools/dhcp_release6.1
220 + fi
221 + fi
222 +
223 + systemd_newunit "${FILESDIR}"/${PN}.service-r1 ${PN}.service
224 +}
225 +
226 +pkg_preinst() {
227 + # temporary workaround to (hopefully) prevent leases file from being removed
228 + [[ -f /var/lib/misc/dnsmasq.leases ]] && cp /var/lib/misc/dnsmasq.leases "${T}"
229 +}
230 +
231 +pkg_postinst() {
232 + # temporary workaround to (hopefully) prevent leases file from being removed
233 + [[ -f "${T}"/dnsmasq.leases ]] && cp "${T}"/dnsmasq.leases /var/lib/misc/dnsmasq.leases
234 +}
235
236 diff --git a/net-dns/dnsmasq/files/dnsmasq-init-dhcp-r3 b/net-dns/dnsmasq/files/dnsmasq-init-dhcp-r3
237 new file mode 100644
238 index 00000000000..5a356b22b25
239 --- /dev/null
240 +++ b/net-dns/dnsmasq/files/dnsmasq-init-dhcp-r3
241 @@ -0,0 +1,35 @@
242 +#!/sbin/openrc-run
243 +# Copyright 1999-2018 Gentoo Foundation
244 +# Distributed under the terms of the GNU General Public License, v2 or later
245 +
246 +extra_started_commands="reload rotate"
247 +
248 +pidfile="/var/run/dnsmasq.pid"
249 +command="/usr/sbin/dnsmasq"
250 +command_args="-x ${pidfile} ${DNSMASQ_OPTS}"
251 +retry="TERM/3/TERM/5"
252 +
253 +depend() {
254 + provide dns
255 + need localmount net
256 + after bootmisc
257 + use logger
258 +}
259 +
260 +start_pre() {
261 + checkpath --owner dnsmasq:dnsmasq \
262 + --mode 0644 \
263 + --file /var/lib/misc/dnsmasq.leases
264 +}
265 +
266 +reload() {
267 + ebegin "Reloading ${RC_SVCNAME}"
268 + start-stop-daemon --signal HUP --pidfile "${pidfile}"
269 + eend $?
270 +}
271 +
272 +rotate() {
273 + ebegin "Reopening ${RC_SVCNAME} log file"
274 + start-stop-daemon --signal USR2 --pidfile "${pidfile}"
275 + eend $?
276 +}
277
278 diff --git a/net-dns/dnsmasq/files/dnsmasq-init-r4 b/net-dns/dnsmasq/files/dnsmasq-init-r4
279 new file mode 100644
280 index 00000000000..559cb1e89d4
281 --- /dev/null
282 +++ b/net-dns/dnsmasq/files/dnsmasq-init-r4
283 @@ -0,0 +1,29 @@
284 +#!/sbin/openrc-run
285 +# Copyright 1999-2018 Gentoo Foundation
286 +# Distributed under the terms of the GNU General Public License, v2 or later
287 +
288 +extra_started_commands="reload rotate"
289 +
290 +pidfile="/var/run/dnsmasq.pid"
291 +command="/usr/sbin/dnsmasq"
292 +command_args="-x ${pidfile} ${DNSMASQ_OPTS}"
293 +retry="TERM/3/TERM/5"
294 +
295 +depend() {
296 + provide dns
297 + need localmount net
298 + after bootmisc
299 + use logger
300 +}
301 +
302 +reload() {
303 + ebegin "Reloading ${RC_SVCNAME}"
304 + start-stop-daemon --signal HUP --pidfile "${pidfile}"
305 + eend $?
306 +}
307 +
308 +rotate() {
309 + ebegin "Reopening ${RC_SVCNAME} log file"
310 + start-stop-daemon --signal USR2 --pidfile "${pidfile}"
311 + eend $?
312 +}
313
314 diff --git a/net-dns/dnsmasq/files/dnsmasq.logrotate b/net-dns/dnsmasq/files/dnsmasq.logrotate
315 new file mode 100644
316 index 00000000000..d689f8f875b
317 --- /dev/null
318 +++ b/net-dns/dnsmasq/files/dnsmasq.logrotate
319 @@ -0,0 +1,7 @@
320 +/var/log/dnsmasq.log {
321 + create 640 dnsmasq root
322 + notifempty
323 + postrotate
324 + test -r /var/run/dnsmasq.pid && kill -USR2 "$(head -n1 /var/run/dnsmasq.pid)"
325 + endscript
326 +}