Gentoo Archives: gentoo-commits

From: Hans de Graaff <graaff@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/munin/
Date: Sat, 22 Jul 2017 08:49:56
Message-Id: 1500713335.4c035bff230e9c1ebd880b082ed9e999a916507e.graaff@gentoo
1 commit: 4c035bff230e9c1ebd880b082ed9e999a916507e
2 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 22 08:48:28 2017 +0000
4 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 22 08:48:55 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c035bff
7
8 net-analyzer/munin: fix bug 595510 and bug 447960
9
10 Fix compatibility with newer netstat, bug 595510
11
12 Use apache2 USE flag instead of apache because apache2 is a
13 global USE flag that is consistently used in the tree, bug 447960
14
15 Package-Manager: Portage-2.3.6, Repoman-2.3.2
16
17 net-analyzer/munin/Manifest | 1 +
18 net-analyzer/munin/munin-2.0.33-r1.ebuild | 412 ++++++++++++++++++++++++++++++
19 2 files changed, 413 insertions(+)
20
21 diff --git a/net-analyzer/munin/Manifest b/net-analyzer/munin/Manifest
22 index c924770f5b6..7b7a162d758 100644
23 --- a/net-analyzer/munin/Manifest
24 +++ b/net-analyzer/munin/Manifest
25 @@ -3,4 +3,5 @@ DIST munin-2.0.19.tar.gz 1335496 SHA256 13db9b00d432b92907d61f9f2bd18c2aafca03b2
26 DIST munin-2.0.25-gentoo-1.tar.xz 10964 SHA256 725a91fe3690a045439fd3d2541de9b67b4fe3628a6c6ec838b690c019f04922 SHA512 9065c24fc7942d6e02e7d2a7d3be516852816164c5ada496aa2703f1e5a3a41bd7f00302348496d58fad7d39d8bb2b84cfa2a2481e92834c6d1958bb153c023f WHIRLPOOL 318b0df95352b2c8a0181ef577179d380b8002288e79ac37d903603fce482ad2f0cbe5e0797495e4d1cb50c765b80daadad8d861ef83d6db89f47effeb7d6183
27 DIST munin-2.0.25.tar.gz 1337586 SHA256 6832bc5839d03639e4309178d9370697fc8a80a83d9b6653953f40161e949694 SHA512 a29563cfef26b05237b3813b44b5582563f2f75477ae3c076540cfb4f3e83f89193bd05fd7eae208d9d1bae58aff75977cc2c5f4de81225f0cbb2ba2c41effa9 WHIRLPOOL 14e7fac3d91025816fa31823484673726441f186ded0bb2a6dc6f4d8f3976211a6fc49c20c7faac5d7078d6f9963766517ee2c9b22820b1164333cb6def106b8
28 DIST munin-2.0.33-gentoo-1.tar.xz 11024 SHA256 f956d9051e0da05231bb8777c0ca3342ca5bb86e48c44a68289c41c42c440e46 SHA512 c1f49f01fd641e157145d9710a091696c09380887a374ee845e516d40384ee6bc576019f3510ac322436b1f10ee1b675ae512b9f677a6a0fa2ef022cbb7269b8 WHIRLPOOL 3c0fbccc4c8ee9a2dacf8ce1845d149198c8d53ed17cd62fd17bae60986ca6616e12213d4f520fd06e8329accec559a7f9529559f21dc62de3aa0b66680d7ab7
29 +DIST munin-2.0.33-gentoo-2.tar.xz 11288 SHA256 a7cc6b060cc1344c9b40278a960ab8fa6848e5db53f8665a952fb602ab0c0c55 SHA512 4d185529199377e85fb3e7d0a8c38de2ae500d2f992292e6ae016d11e81642833725987ac006b5f535963593c7698c676d28091805691e8b46c016fc2580917d WHIRLPOOL 98d2916c10adf554ab1672c602271673cb6dea7ae72fb7849b1bdf16d6f63c6f330def1f4a3cb62fd1fab4e888b2dede2807cde9a7907058f37a0f87a8b67a6b
30 DIST munin-2.0.33.tar.gz 1349546 SHA256 99dbc1e5f4f0fed4e28f295245333544193f9a26c597f2a78571ae20b4d450b6 SHA512 33c56fcb347396f29662f304aa50f0e3dfc909b067ea49809762bbbb4dd2cd7e95789c318adcef64923e6d0248dcf9ea6fe933c49d920b6b7856d85511d40d67 WHIRLPOOL 2429b605d19bbf4caa460e9f2b46de8e2462bf606bd1143bcdcbb4f2e079b2acf5f87def86affa6152ed8b26cf14bc83d62274bb58424818deb2b5f2024de7f0
31
32 diff --git a/net-analyzer/munin/munin-2.0.33-r1.ebuild b/net-analyzer/munin/munin-2.0.33-r1.ebuild
33 new file mode 100644
34 index 00000000000..6ab07a42f8a
35 --- /dev/null
36 +++ b/net-analyzer/munin/munin-2.0.33-r1.ebuild
37 @@ -0,0 +1,412 @@
38 +# Copyright 1999-2017 Gentoo Foundation
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=6
42 +
43 +PATCHSET=2
44 +
45 +inherit eutils user java-pkg-opt-2 systemd
46 +
47 +MY_P=${P/_/-}
48 +
49 +DESCRIPTION="Munin Server Monitoring Tool"
50 +HOMEPAGE="http://munin-monitoring.org/"
51 +SRC_URI="
52 + https://github.com/munin-monitoring/munin/archive/${PV}.tar.gz -> ${P}.tar.gz
53 + https://dev.gentoo.org/~graaff/munin/${P}-gentoo-${PATCHSET}.tar.xz"
54 +
55 +LICENSE="GPL-2"
56 +SLOT="0"
57 +KEYWORDS="~amd64 ~arm ~mips ~ppc ~x86"
58 +IUSE="asterisk irc java memcached minimal mysql postgres selinux ssl test cgi ipv6 syslog ipmi http dhcpd doc apache2"
59 +REQUIRED_USE="cgi? ( !minimal ) apache2? ( cgi )"
60 +
61 +# Upstream's listing of required modules is NOT correct!
62 +# Some of the postgres plugins use DBD::Pg, while others call psql directly.
63 +# Some of the mysql plugins use DBD::mysql, while others call mysqladmin directly.
64 +# We replace the original ipmi plugins with the freeipmi_ plugin which at least works.
65 +DEPEND_COM="
66 + dev-lang/perl:=[berkdb]
67 + dev-perl/DBI
68 + dev-perl/Date-Manip
69 + dev-perl/File-Copy-Recursive
70 + dev-perl/List-MoreUtils
71 + dev-perl/Log-Log4perl
72 + dev-perl/Net-CIDR
73 + dev-perl/Net-DNS
74 + dev-perl/Net-Netmask
75 + dev-perl/Net-SNMP
76 + dev-perl/Net-Server[ipv6(-)?]
77 + virtual/perl-Digest-MD5
78 + virtual/perl-Getopt-Long
79 + virtual/perl-MIME-Base64
80 + virtual/perl-Storable
81 + virtual/perl-Text-Balanced
82 + virtual/perl-Time-HiRes
83 + apache2? ( www-servers/apache[apache2_modules_cgi,apache2_modules_cgid,apache2_modules_rewrite] )
84 + asterisk? ( dev-perl/Net-Telnet )
85 + cgi? (
86 + dev-perl/FCGI
87 + dev-perl/CGI-Fast
88 + )
89 + dhcpd? (
90 + >=net-misc/dhcp-3[server]
91 + dev-perl/Net-IP
92 + dev-perl/HTTP-Date
93 + )
94 + doc? ( dev-python/sphinx )
95 + http? ( dev-perl/libwww-perl )
96 + irc? ( dev-perl/Net-IRC )
97 + kernel_linux? ( sys-process/procps )
98 + memcached? ( dev-perl/Cache-Memcached )
99 + mysql? (
100 + virtual/mysql
101 + dev-perl/Cache-Cache
102 + dev-perl/DBD-mysql
103 + )
104 + postgres? ( dev-perl/DBD-Pg dev-db/postgresql:* )
105 + ssl? ( dev-perl/Net-SSLeay )
106 + syslog? ( virtual/perl-Sys-Syslog )
107 + !minimal? (
108 + dev-perl/HTML-Template
109 + dev-perl/IO-Socket-INET6
110 + dev-perl/URI
111 + >=net-analyzer/rrdtool-1.3[graph,perl]
112 + virtual/ssh
113 + )
114 + "
115 +
116 +# Keep this seperate, as previous versions have had other deps here
117 +DEPEND="${DEPEND_COM}
118 + dev-perl/Module-Build
119 + java? ( >=virtual/jdk-1.5 )
120 + test? (
121 + dev-perl/Test-Deep
122 + dev-perl/Test-LongString
123 + dev-perl/Test-Differences
124 + dev-perl/Test-MockModule
125 + dev-perl/Test-MockObject
126 + dev-perl/File-Slurp
127 + dev-perl/IO-stringy
128 + dev-perl/IO-Socket-INET6
129 + )"
130 +RDEPEND="${DEPEND_COM}
131 + virtual/awk
132 + ipmi? ( >=sys-libs/freeipmi-1.1.6-r1 )
133 + java? (
134 + >=virtual/jre-1.5
135 + || ( net-analyzer/netcat6 net-analyzer/netcat )
136 + )
137 + !minimal? (
138 + virtual/cron
139 + media-fonts/dejavu
140 + )
141 + selinux? ( sec-policy/selinux-munin )
142 + !<sys-apps/openrc-0.11.8"
143 +
144 +S="${WORKDIR}/${MY_P}"
145 +
146 +pkg_setup() {
147 + enewgroup munin
148 + enewuser munin 177 -1 /var/lib/munin munin
149 + enewuser munin-async -1 /bin/sh /var/spool/munin-async
150 + esethome munin-async /var/spool/munin-async
151 + java-pkg-opt-2_pkg_setup
152 +}
153 +
154 +src_prepare() {
155 + epatch "${WORKDIR}"/patches/*.patch
156 +
157 + eapply_user
158 +
159 + java-pkg-opt-2_src_prepare
160 +}
161 +
162 +src_configure() {
163 + local cgidir='$(DESTDIR)/usr/libexec/munin/cgi'
164 + use cgi || cgidir="${T}/useless/cgi-bin"
165 +
166 + local cgiuser=$(usex apache2 apache munin)
167 +
168 + cat >> "${S}"/Makefile.config <<- EOF
169 + PREFIX=\$(DESTDIR)/usr
170 + CONFDIR=\$(DESTDIR)/etc/munin
171 + DOCDIR=${T}/useless/doc
172 + MANDIR=\$(PREFIX)/share/man
173 + LIBDIR=\$(PREFIX)/libexec/munin
174 + HTMLDIR=\$(DESTDIR)/var/www/localhost/htdocs/munin
175 + CGIDIR=${cgidir}
176 + CGITMPDIR=\$(DESTDIR)/var/cache/munin-cgi
177 + CGIUSER=${cgiuser}
178 + DBDIR=\$(DESTDIR)/var/lib/munin
179 + DBDIRNODE=\$(DESTDIR)/var/lib/munin-node
180 + SPOOLDIR=\$(DESTDIR)/var/spool/munin-async
181 + LOGDIR=\$(DESTDIR)/var/log/munin
182 + PERLSITELIB=$(perl -V:vendorlib | cut -d"'" -f2)
183 + JCVALID=$(usex java yes no)
184 + STATEDIR=\$(DESTDIR)/run/munin
185 + EOF
186 +}
187 +
188 +# parallel make and install need to be fixed before, and I haven't
189 +# gotten around to do so yet.
190 +src_compile() {
191 + emake -j1
192 + use doc && emake -C doc html
193 +}
194 +
195 +src_test() {
196 + if [[ ${EUID} == 0 ]]; then
197 + eerror "You cannot run tests as root."
198 + eerror "Please enable FEATURES=userpriv before proceeding."
199 + return 1
200 + fi
201 +
202 + local testtargets="test-common test-node test-plugins"
203 + use minimal || testtargets+=" test-master"
204 +
205 + LC_ALL=C emake -j1 ${testtargets}
206 +}
207 +
208 +src_install() {
209 + local dirs="
210 + /var/log/munin
211 + /var/lib/munin/plugin-state
212 + /etc/munin/plugin-conf.d
213 + /etc/munin/plugins"
214 + use minimal || dirs+=" /etc/munin/munin-conf.d/"
215 +
216 + keepdir ${dirs}
217 + fowners munin:munin ${dirs}
218 +
219 + # parallel install doesn't work and it's also pointless to have this
220 + # run in parallel for now (because it uses internal loops).
221 + emake -j1 DESTDIR="${D}" $(usex minimal "install-minimal install-man" install)
222 +
223 + # we remove /run from the install, as it's not the package's to deal
224 + # with.
225 + rm -rf "${D}"/run || die
226 +
227 + # remove the plugins for non-Gentoo package managers; use -f so that
228 + # it doesn't fail when installing on non-Linux platforms.
229 + rm -f "${D}"/usr/libexec/munin/plugins/{apt{,_all},yum} || die
230 +
231 + insinto /etc/munin/plugin-conf.d/
232 + newins "${FILESDIR}"/${PN}-1.3.2-plugins.conf munin-node
233 +
234 + newinitd "${FILESDIR}"/munin-node_init.d_2.0.19 munin-node
235 + newconfd "${FILESDIR}"/munin-node_conf.d_1.4.6-r2 munin-node
236 +
237 + newinitd "${FILESDIR}"/munin-asyncd.init.2 munin-asyncd
238 +
239 + dodir /usr/lib/tmpfiles.d
240 + cat > "${D}"/usr/lib/tmpfiles.d/${CATEGORY}:${PN}:${SLOT}.conf <<- EOF
241 + d /run/munin 0700 munin munin - -
242 + EOF
243 +
244 + systemd_dounit "${FILESDIR}"/munin-async.service
245 + systemd_dounit "${FILESDIR}"/munin-graph.{service,socket}
246 + systemd_dounit "${FILESDIR}"/munin-html.{service,socket}
247 + systemd_dounit "${FILESDIR}"/munin-node.service
248 +
249 + cat >> "${T}"/munin.env <<- EOF
250 + CONFIG_PROTECT=/var/spool/munin-async/.ssh
251 + EOF
252 + newenvd "${T}"/munin.env 50munin
253 +
254 + dodoc README ChangeLog INSTALL
255 + if use doc; then
256 + cd "${S}"/doc/_build/html || die
257 + docinto html
258 + dodoc -r *
259 + cd "${S}" || die
260 + fi
261 +
262 + dodir /etc/logrotate.d/
263 + sed -e "s:@CGIUSER@:$(usex apache2 apache munin):g" \
264 + "${FILESDIR}"/logrotate.d-munin.3 > "${D}"/etc/logrotate.d/munin
265 +
266 + dosym ipmi_ /usr/libexec/munin/plugins/ipmi_sensor_
267 +
268 + if use syslog; then
269 + sed -i -e '/log_file/s| .*| Sys::Syslog|' \
270 + "${D}"/etc/munin/munin-node.conf || die
271 + fi
272 +
273 + # Use a simpler pid file to avoid trouble with /run in tmpfs. The
274 + # munin-node service is ran as user root, and only later drops
275 + # privileges.
276 + sed -i -e 's:/run/munin/munin-node.pid:/run/munin-node.pid:' \
277 + "${D}"/etc/munin/munin-node.conf || die
278 +
279 + keepdir /var/spool/munin-async/.ssh
280 + touch "${D}"/var/spool/munin-async/.ssh/authorized_keys
281 + fowners munin-async:munin /var/spool/munin-async{,/.ssh/{,authorized_keys}}
282 + fperms 0750 /var/spool/munin-async{,/.ssh}
283 + fperms 0600 /var/spool/munin-async/.ssh/authorized_keys
284 +
285 + if use minimal; then
286 + # This requires the presence of munin-update, which is part of
287 + # the non-minimal install...
288 + rm "${D}"/usr/libexec/munin/plugins/munin_stats
289 + else
290 + # remove font files so that we don't have to keep them around
291 + rm "${D}"/usr/libexec/${PN}/*.ttf || die
292 +
293 + if use cgi; then
294 + sed -i -e '/#graph_strategy cgi/s:^#::' "${D}"/etc/munin/munin.conf || die
295 +
296 + keepdir /var/cache/munin-cgi
297 + touch "${D}"/var/log/munin/munin-cgi-{graph,html}.log
298 + fowners $(usex apache2 apache munin) \
299 + /var/cache/munin-cgi \
300 + /var/log/munin/munin-cgi-{graph,html}.log
301 +
302 + if use apache2; then
303 + insinto /etc/apache2/vhosts.d
304 + newins "${FILESDIR}"/munin.apache.include munin.include
305 + newins "${FILESDIR}"/munin.apache.include-2.4 munin-2.4.include
306 + fi
307 + else
308 + sed \
309 + -e '/#graph_strategy cgi/s:#graph_strategy cgi:graph_strategy cron:' \
310 + -i "${D}"/etc/munin/munin.conf || die
311 + fi
312 +
313 + keepdir /var/lib/munin/.ssh
314 + cat >> "${D}"/var/lib/munin/.ssh/config <<- EOF
315 + IdentityFile /var/lib/munin/.ssh/id_ecdsa
316 + IdentityFile /var/lib/munin/.ssh/id_rsa
317 + EOF
318 +
319 + fowners munin:munin /var/lib/munin/.ssh/{,config}
320 + fperms go-rwx /var/lib/munin/.ssh/{,config}
321 +
322 + dodir /usr/share/${PN}
323 + cat >> "${D}"/usr/share/${PN}/crontab <<- EOF
324 + # Force the shell to bash
325 + SHELL=/bin/bash
326 + # Mail reports to root@, not munin@
327 + MAILTO=root
328 +
329 + # This runs the munin task every 5 minutes.
330 + */5 * * * * /usr/bin/munin-cron
331 +
332 + # Alternatively, this route works differently
333 + # Update once a minute (for busy sites)
334 + #*/1 * * * * /usr/libexec/munin/munin-update
335 + ## Check for limit excess every 2 minutes
336 + #*/2 * * * * /usr/libexec/munin/munin-limits
337 + ## Update graphs every 5 minutes
338 + #*/5 * * * * nice /usr/libexec/munin/munin-graph
339 + ## Update HTML pages every 15 minutes
340 + #*/15 * * * * nice /usr/libexec/munin/munin-html
341 + EOF
342 +
343 + cat >> "${D}"/usr/share/${PN}/fcrontab <<- EOF
344 + # Mail reports to root@, not munin@, only execute one at a time
345 + !mailto(root),serial(true)
346 +
347 + # This runs the munin task every 5 minutes.
348 + @ 5 /usr/bin/munin-cron
349 +
350 + # Alternatively, this route works differently
351 + # Update once a minute (for busy sites)
352 + #@ 1 /usr/libexec/munin/munin-update
353 + ## Check for limit excess every 2 minutes
354 + #@ 2 /usr/libexec/munin/munin-limits
355 + ## Update graphs every 5 minutes
356 + #@ 5 nice /usr/libexec/munin/munin-graph
357 + ## Update HTML pages every 15 minutes
358 + #@ 15 nice /usr/libexec/munin/munin-html
359 + EOF
360 +
361 + # remove .htaccess file
362 + find "${D}" -name .htaccess -delete || die
363 + fi
364 +}
365 +
366 +pkg_config() {
367 + if use minimal; then
368 + einfo "Nothing to do."
369 + return 0
370 + fi
371 +
372 + einfo "Press enter to install the default crontab for the munin master"
373 + einfo "installation from /usr/share/${PN}/f?crontab"
374 + einfo "If you have a large site, you may wish to customize it."
375 + read
376 +
377 + ebegin "Setting up cron ..."
378 + if has_version sys-process/fcron; then
379 + fcrontab - -u munin < /usr/share/${PN}/fcrontab
380 + else
381 + # dcron is very fussy about syntax
382 + # the following is the only form that works in BOTH dcron and vixie-cron
383 + crontab - -u munin < /usr/share/${PN}/crontab
384 + fi
385 + eend $?
386 +
387 + einfo "Press enter to set up the SSH keys used for SSH transport"
388 + read
389 +
390 + # generate one rsa (for legacy) and one ecdsa (for new systems)
391 + ssh-keygen -t rsa \
392 + -f /var/lib/munin/.ssh/id_rsa -N '' \
393 + -C "created by portage for ${CATEGORY}/${PN}" || die
394 + ssh-keygen -t ecdsa \
395 + -f /var/lib/munin/.ssh/id_ecdsa -N '' \
396 + -C "created by portage for ${CATEGORY}/${PN}" || die
397 + chown -R munin:munin /var/lib/munin/.ssh || die
398 + chmod 0600 /var/lib/munin/.ssh/id_{rsa,ecdsa} || die
399 +
400 + einfo "Your public keys are available in "
401 + einfo " /var/lib/munin/.ssh/id_rsa.pub"
402 + einfo " /var/lib/munin/.ssh/id_ecdsa.pub"
403 + einfo "and follows for convenience"
404 + echo
405 + cat /var/lib/munin/.ssh/id_*.pub
406 +}
407 +
408 +pkg_postinst() {
409 + elog "Please follow the munin documentation to set up the plugins you"
410 + elog "need, afterwards start munin-node."
411 + elog ""
412 + elog "To make use of munin-async, make sure to set up the corresponding"
413 + elog "SSH key in /var/lib/munin-async/.ssh/authorized_keys"
414 + elog ""
415 + if ! use minimal; then
416 + elog "Please run"
417 + elog " emerge --config net-analyzer/munin"
418 + elog "to automatically configure munin's cronjobs as well as generate"
419 + elog "passwordless SSH keys to be used with munin-async."
420 + fi
421 + elog ""
422 + elog "Further information about setting up Munin in Gentoo can be found"
423 + elog "in the Gentoo Wiki: https://wiki.gentoo.org/wiki/Munin"
424 +
425 + if use cgi; then
426 + chown $(usex apache2 apache munin) \
427 + "${ROOT}"/var/cache/munin-cgi \
428 + "${ROOT}"/var/log/munin/munin-cgi-{graph,html}.log
429 +
430 + if use apache2; then
431 + elog "To use Munin with CGI you should include /etc/apache2/vhosts.d/munin.include"
432 + elog "or /etc/apache2/vhosts.d/munin-2.4.include (for Apache 2.4) from the virtual"
433 + elog "host you want it to be served."
434 + elog "If you want to enable CGI-based HTML as well, you have to add to"
435 + elog "/etc/conf.d/apache2 the option -D MUNIN_HTML_CGI."
436 + else
437 + elog "Effective CGI support has just been added in 2.0.7-r6."
438 + elog "Documentation on how to use it is still sparse."
439 + fi
440 + fi
441 +
442 + # we create this here as we don't want Portage to check /run
443 + # symlinks but we still need this to be present before the reboot.
444 + if ! use minimal && ! [[ -d "${ROOT}"/run/munin ]]; then
445 + mkdir "${ROOT}"/run/munin
446 + chown munin:munin "${ROOT}"/run/munin
447 + chmod 0700 "${ROOT}"/run/munin
448 + fi
449 +}