Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-metrics/collectd/
Date: Sat, 20 Jul 2019 00:13:30
Message-Id: 1563581598.1fbba9d0b637ec19e0dc5a2bb45681756e13f6ca.whissi@gentoo
1 commit: 1fbba9d0b637ec19e0dc5a2bb45681756e13f6ca
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 20 00:12:50 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 20 00:13:18 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1fbba9d0
7
8 app-metrics/collectd: bump to v5.9.0
9
10 Package-Manager: Portage-2.3.68, Repoman-2.3.16
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 app-metrics/collectd/Manifest | 1 +
14 app-metrics/collectd/collectd-5.9.0.ebuild | 541 +++++++++++++++++++++++++++++
15 2 files changed, 542 insertions(+)
16
17 diff --git a/app-metrics/collectd/Manifest b/app-metrics/collectd/Manifest
18 index f639ce1d2be..d9352a618fb 100644
19 --- a/app-metrics/collectd/Manifest
20 +++ b/app-metrics/collectd/Manifest
21 @@ -1 +1,2 @@
22 DIST collectd-5.8.1.tar.bz2 1789228 BLAKE2B 739f961172978db33bdf95c8f93bde0036a26b2ed2abd3396a734d4b97c4ae117bb26a62fcdbb3d77bd63d9f64a38f83d0c8a0665e8fa7bf5ed2efc6838b0e8e SHA512 8c75448c6e59ee1ea5c1cf486c07040d20fb36d5b7a1be2ab45facea330166e8c1d1fa38e3fa82ec905428d7b2c92c66aae35ee8e3546f67ce76f7f410739901
23 +DIST collectd-5.9.0.tar.bz2 1899573 BLAKE2B 0cd3d33ed219e56a42f737fa1d11eb8b85b1368bc33553c49e950d3a7805fa683e9a1b7d2ae9bbd3d195d051563cd800b472b56a874bc0482730bcd91ca2c38e SHA512 f2bf9896dd8fa116834418ea46aabdb160002da7f2600b7d5120d40eb7a956ccc845299696c854c2335946903374c84bbaeb28667319bf07b7a54ea465cccd54
24
25 diff --git a/app-metrics/collectd/collectd-5.9.0.ebuild b/app-metrics/collectd/collectd-5.9.0.ebuild
26 new file mode 100644
27 index 00000000000..a4f4ae59b3e
28 --- /dev/null
29 +++ b/app-metrics/collectd/collectd-5.9.0.ebuild
30 @@ -0,0 +1,541 @@
31 +# Copyright 1999-2019 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI="6"
35 +
36 +PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} )
37 +JAVA_PKG_OPT_USE="collectd_plugins_java"
38 +
39 +inherit autotools fcaps flag-o-matic java-pkg-opt-2 linux-info multilib perl-functions python-single-r1 systemd tmpfiles user
40 +
41 +DESCRIPTION="Collects system statistics and provides mechanisms to store the values"
42 +
43 +HOMEPAGE="https://collectd.org/"
44 +SRC_URI="${HOMEPAGE%/}/files/${P}.tar.bz2"
45 +
46 +LICENSE="MIT GPL-2 GPL-2+ GPL-3 GPL-3+"
47 +SLOT="0"
48 +KEYWORDS="~alpha ~amd64 ~arm ~x86"
49 +IUSE="contrib debug java kernel_Darwin kernel_FreeBSD kernel_linux perl selinux static-libs udev xfs"
50 +
51 +# The plugin lists have to follow here since they extend IUSE
52 +
53 +# Plugins that don't build (e.g. dependencies not in Gentoo)
54 +# apple_sensors: Requires libIOKit
55 +# amqp1: Requires libqpid-proton
56 +# aquaero: Requires aerotools-ng/libaquaero5
57 +# barometer: Requires libi2c (i2c_smbus_read_i2c_block_data)
58 +# dpdkevents: Requires dpdk
59 +# dpdkstat: Requires dpdk
60 +# grpc: Requires libgrpc
61 +# intel_pmu: Requires libjevents (pmu-tools)
62 +# intel_rdt: Requires libpqos from intel-cmt-cat project
63 +# lpar: Requires libperfstat (AIX only)
64 +# mic: Requires Intel Many Integrated Core Architecture API
65 +# (part of Intel's Xeon Phi software)
66 +# netapp: Requires libnetapp (http://communities.netapp.com/docs/DOC-1110)
67 +# pf: Requires BSD packet filter
68 +# pinba: Requires MySQL Pinba engine (http://pinba.org/)
69 +# tape: Requires libkstat (Solaris only)
70 +# write_riemann: Requires riemann-c-client
71 +# xmms: Requires libxmms (v1)
72 +# zone: Solaris only...
73 +COLLECTD_IMPOSSIBLE_PLUGINS="apple_sensors amqp1 aquaero barometer dpdkstat
74 + grpc intel_pmu intel_rdt lpar mic netapp pf pinba tape write_riemann
75 + xmms zone"
76 +
77 +# Plugins that have been (compile) tested and can be enabled via COLLECTD_PLUGINS
78 +COLLECTD_TESTED_PLUGINS="aggregation amqp apache apcups ascent battery bind
79 + ceph cgroups chrony conntrack contextswitch cpu cpufreq cpusleep
80 + csv curl curl_json curl_xml dbi df disk dns drbd email
81 + entropy ethstat exec fhcount filecount fscache gmond gps hddtemp
82 + hugepages interface ipc ipmi iptables ipvs irq java lua
83 + load logfile log_logstash lvm madwifi match_empty_counter
84 + match_hashed match_regex match_timediff match_value mbmon mcelog md
85 + memcachec memcached memory modbus mqtt multimeter mysql netlink
86 + network network nfs nginx notify_desktop notify_email notify_nagios
87 + ntpd numa nut olsrd onewire openldap openvpn oracle ovs_events
88 + ovs_stats perl ping postgresql powerdns processes protocols python
89 + python redis routeros rrdcached rrdtool sensors serial sigrok smart
90 + snmp snmp_agent statsd swap syslog table tail tail_csv
91 + target_notification target_replace target_scale target_set tcpconns
92 + teamspeak2 ted thermal threshold tokyotyrant turbostat unixsock
93 + uptime users uuid varnish virt vmem vserver wireless write_graphite
94 + write_http write_kafka write_log write_mongodb write_prometheus
95 + write_redis write_sensu write_tsdb xencpu zfs_arc zookeeper"
96 +
97 +COLLECTD_DISABLED_PLUGINS="${COLLECTD_IMPOSSIBLE_PLUGINS}"
98 +
99 +COLLECTD_ALL_PLUGINS=${COLLECTD_TESTED_PLUGINS}
100 +
101 +for plugin in ${COLLECTD_ALL_PLUGINS}; do
102 + IUSE="${IUSE} collectd_plugins_${plugin}"
103 +done
104 +unset plugin
105 +
106 +# Now come the dependencies.
107 +
108 +COMMON_DEPEND="
109 + dev-libs/libgcrypt:=
110 + dev-libs/libltdl:0=
111 + perl? ( dev-lang/perl:=[ithreads] )
112 + udev? ( virtual/udev )
113 + xfs? ( sys-fs/xfsprogs )
114 + collectd_plugins_amqp? ( net-libs/rabbitmq-c )
115 + collectd_plugins_apache? ( net-misc/curl:0= )
116 + collectd_plugins_ascent? ( net-misc/curl:0= dev-libs/libxml2:2= )
117 + collectd_plugins_bind? ( net-misc/curl:0= dev-libs/libxml2:2= )
118 + collectd_plugins_ceph? ( dev-libs/yajl:= )
119 + collectd_plugins_curl? ( net-misc/curl:0= )
120 + collectd_plugins_curl_json? ( net-misc/curl:0= dev-libs/yajl:= )
121 + collectd_plugins_curl_xml? ( net-misc/curl:0= dev-libs/libxml2:2= )
122 + collectd_plugins_dbi? ( dev-db/libdbi )
123 + collectd_plugins_dns? ( net-libs/libpcap )
124 + collectd_plugins_gmond? ( sys-cluster/ganglia )
125 + collectd_plugins_gps? ( sci-geosciences/gpsd:= )
126 + collectd_plugins_ipmi? ( >=sys-libs/openipmi-2.0.16-r1 )
127 + collectd_plugins_iptables? ( >=net-firewall/iptables-1.4.13:0= )
128 + collectd_plugins_log_logstash? ( dev-libs/yajl:= )
129 + collectd_plugins_lua? ( dev-lang/lua:0= )
130 + collectd_plugins_lvm? ( sys-fs/lvm2 )
131 + collectd_plugins_memcachec? ( dev-libs/libmemcached )
132 + collectd_plugins_modbus? ( dev-libs/libmodbus )
133 + collectd_plugins_mqtt? ( app-misc/mosquitto )
134 + collectd_plugins_mysql? ( virtual/libmysqlclient:= )
135 + collectd_plugins_netlink? ( net-libs/libmnl )
136 + collectd_plugins_nginx? ( net-misc/curl:0= )
137 + collectd_plugins_notify_desktop? ( x11-libs/libnotify )
138 + collectd_plugins_notify_email? ( net-libs/libesmtp )
139 + collectd_plugins_nut? ( >=sys-power/nut-2.7.2-r2 )
140 + collectd_plugins_openldap? ( net-nds/openldap )
141 + collectd_plugins_onewire? ( >=sys-fs/owfs-3.1:= )
142 + collectd_plugins_oracle? ( dev-db/oracle-instantclient-basic )
143 + collectd_plugins_ovs_events? ( dev-libs/yajl:= )
144 + collectd_plugins_ovs_stats? ( dev-libs/yajl:= )
145 + collectd_plugins_perl? ( dev-lang/perl:=[ithreads] )
146 + collectd_plugins_ping? ( net-libs/liboping )
147 + collectd_plugins_postgresql? ( dev-db/postgresql:= )
148 + collectd_plugins_python? ( ${PYTHON_DEPS} )
149 + collectd_plugins_redis? ( dev-libs/hiredis:= )
150 + collectd_plugins_routeros? ( net-libs/librouteros )
151 + collectd_plugins_rrdcached? ( net-analyzer/rrdtool:= )
152 + collectd_plugins_rrdtool? ( net-analyzer/rrdtool:= )
153 + collectd_plugins_sensors? ( sys-apps/lm_sensors:= )
154 + collectd_plugins_sigrok? ( <sci-libs/libsigrok-0.4:= dev-libs/glib:2 )
155 + collectd_plugins_smart? ( dev-libs/libatasmart )
156 + collectd_plugins_snmp? ( net-analyzer/net-snmp )
157 + collectd_plugins_snmp_agent? ( net-analyzer/net-snmp )
158 + collectd_plugins_tokyotyrant? ( net-misc/tokyotyrant )
159 + collectd_plugins_varnish? ( www-servers/varnish:= )
160 + collectd_plugins_virt? ( app-emulation/libvirt:= dev-libs/libxml2:2= )
161 + collectd_plugins_write_http? ( net-misc/curl:0= dev-libs/yajl:= )
162 + collectd_plugins_write_kafka? ( >=dev-libs/librdkafka-0.9.0.99:= dev-libs/yajl:= )
163 + collectd_plugins_write_mongodb? ( >=dev-libs/mongo-c-driver-1.8.2:= )
164 + collectd_plugins_write_prometheus? ( >=dev-libs/protobuf-c-1.2.1-r1:= net-libs/libmicrohttpd:= )
165 + collectd_plugins_write_redis? ( dev-libs/hiredis:= )
166 + collectd_plugins_xencpu? ( app-emulation/xen-tools:= )
167 +
168 + kernel_FreeBSD? (
169 + collectd_plugins_disk? ( sys-libs/libstatgrab:= )
170 + collectd_plugins_interface? ( sys-libs/libstatgrab:= )
171 + collectd_plugins_load? ( sys-libs/libstatgrab:= )
172 + collectd_plugins_memory? ( sys-libs/libstatgrab:= )
173 + collectd_plugins_swap? ( sys-libs/libstatgrab:= )
174 + collectd_plugins_users? ( sys-libs/libstatgrab:= )
175 + )"
176 +
177 +# Enforcing !=sys-kernel/linux-headers-4.5 > due to #577846
178 +DEPEND="${COMMON_DEPEND}
179 + collectd_plugins_iptables? ( || ( <=sys-kernel/linux-headers-4.4 >=sys-kernel/linux-headers-4.6 ) )
180 + collectd_plugins_java? ( >=virtual/jdk-1.6 )
181 + virtual/pkgconfig"
182 +
183 +RDEPEND="${COMMON_DEPEND}
184 + collectd_plugins_java? ( >=virtual/jre-1.6 )
185 + collectd_plugins_syslog? ( virtual/logger )
186 + selinux? ( sec-policy/selinux-collectd )
187 + !<sys-apps/openrc-0.18.2"
188 +
189 +REQUIRED_USE="
190 + collectd_plugins_python? ( ${PYTHON_REQUIRED_USE} )
191 + collectd_plugins_smart? ( udev )"
192 +
193 +PATCHES=()
194 +
195 +# @FUNCTION: collectd_plugin_kernel_linux
196 +# @DESCRIPTION:
197 +# USAGE: <plugin name> <kernel_options> <severity>
198 +# kernel_options is a list of kernel configurations options; the check tests whether at least
199 +# one of them is enabled. If no, depending on the third argument an elog, ewarn, or eerror message
200 +# is emitted.
201 +collectd_plugin_kernel_linux() {
202 + local multi_opt opt
203 + if has ${1} ${COLLECTD_ALL_PLUGINS}; then
204 + if use collectd_plugins_${1}; then
205 + for opt in ${2}; do
206 + if linux_chkconfig_present ${opt}; then
207 + return 0;
208 + fi
209 + done
210 + multi_opt=${2//\ /\ or\ }
211 + case ${3} in
212 + (info)
213 + elog "The ${1} plugin can use kernel features that are disabled now; enable ${multi_opt} in your kernel"
214 + ;;
215 + (warn)
216 + ewarn "The ${1} plugin uses kernel features that are disabled now; enable ${multi_opt} in your kernel"
217 + ;;
218 + (error)
219 + eerror "The ${1} plugin needs kernel features that are disabled now; enable ${multi_opt} in your kernel"
220 + ;;
221 + (*)
222 + die "function collectd_plugin_kernel_linux called with invalid third argument"
223 + ;;
224 + esac
225 + fi
226 + fi
227 +}
228 +
229 +collectd_linux_kernel_checks() {
230 + if ! linux_chkconfig_present PROC_FS; then
231 + ewarn "/proc file system support is disabled, many plugins will not be able to read any statistics from your system unless you enable PROC_FS in your kernel"
232 + fi
233 +
234 + if ! linux_chkconfig_present SYSFS; then
235 + ewarn "/sys file system support is disabled, many plugins will not be able to read any statistics from your system unless you enable SYSFS in your kernel"
236 + fi
237 +
238 + # battery.c: /proc/pmu/battery_%i
239 + # battery.c: /proc/acpi/battery
240 + collectd_plugin_kernel_linux battery ACPI_BATTERY warn
241 +
242 + # cgroups.c: /sys/fs/cgroup/
243 + collectd_plugin_kernel_linux cgroups CGROUPS warn
244 +
245 + # cpufreq.c: /sys/devices/system/cpu/cpu%d/cpufreq/
246 + collectd_plugin_kernel_linux cpufreq SYSFS warn
247 + collectd_plugin_kernel_linux cpufreq CPU_FREQ_STAT warn
248 +
249 + # drbd.c: /proc/drbd
250 + collectd_plugin_kernel_linux drbd BLK_DEV_DRBD warn
251 +
252 + # conntrack.c: /proc/sys/net/netfilter/*
253 + collectd_plugin_kernel_linux conntrack NETFILTER warn
254 +
255 + # fscache.c: /proc/fs/fscache/stats
256 + collectd_plugin_kernel_linux fscache FSCACHE warn
257 +
258 + # nfs.c: /proc/net/rpc/nfs
259 + # nfs.c: /proc/net/rpc/nfsd
260 + collectd_plugin_kernel_linux nfs NFS_COMMON warn
261 +
262 + # serial.c: /proc/tty/driver/serial
263 + # serial.c: /proc/tty/driver/ttyS
264 + collectd_plugin_kernel_linux serial SERIAL_CORE warn
265 +
266 + # swap.c: /proc/meminfo
267 + collectd_plugin_kernel_linux swap SWAP warn
268 +
269 + # thermal.c: /proc/acpi/thermal_zone
270 + # thermal.c: /sys/class/thermal
271 + collectd_plugin_kernel_linux thermal ACPI_THERMAL warn
272 +
273 + # turbostat.c: /dev/cpu/%d/msr
274 + collectd_plugin_kernel_linux turbostat X86_MSR warn
275 +
276 + # vmem.c: /proc/vmstat
277 + collectd_plugin_kernel_linux vmem VM_EVENT_COUNTERS warn
278 +
279 + # vserver.c: /proc/virtual
280 + collectd_plugin_kernel_linux vserver VSERVER warn
281 +
282 + # uuid.c: /sys/hypervisor/uuid
283 + collectd_plugin_kernel_linux uuid SYSFS info
284 +
285 + # wireless.c: /proc/net/wireless
286 + collectd_plugin_kernel_linux wireless "WIRELESS MAC80211 IEEE80211" warn
287 +
288 + # zfs_arc.c: /proc/spl/kstat/zfs/arcstats
289 + collectd_plugin_kernel_linux zfs_arc "SPL ZFS" warn
290 +}
291 +
292 +pkg_setup() {
293 + if use kernel_linux; then
294 + linux-info_pkg_setup
295 +
296 + if linux_config_exists; then
297 + einfo "Checking your linux kernel configuration:"
298 + collectd_linux_kernel_checks
299 + else
300 + elog "Cannot find a linux kernel configuration. Continuing anyway."
301 + fi
302 + fi
303 +
304 + if use collectd_plugins_java; then
305 + java-pkg-opt-2_pkg_setup
306 + fi
307 +
308 + use collectd_plugins_python && python-single-r1_pkg_setup
309 +
310 + enewgroup collectd
311 + enewuser collectd -1 -1 /var/lib/collectd collectd
312 +}
313 +
314 +src_prepare() {
315 + default
316 +
317 + # There's some strange prefix handling in the default config file, resulting in
318 + # paths like "/usr/var/..."
319 + sed -i -e "s:@prefix@/var:/var:g" src/collectd.conf.in || die
320 +
321 + # Adjust upstream's systemd unit
322 + # - Get rid of EnvironmentFile directive; These files don't exist on Gentoo!
323 + # - Add User=collectd to run collectd as user "collectd" per default
324 + sed -i \
325 + -e '/^EnvironmentFile=.*/d' \
326 + -e '/^\[Service\]/aUser=collectd' \
327 + contrib/systemd.${PN}.service || die
328 +
329 + eautoreconf
330 +}
331 +
332 +src_configure() {
333 + # Now come the lists of os-dependent plugins. Any plugin that is not listed anywhere here
334 + # should work independent of the operating system.
335 +
336 + local linux_plugins="barometer battery cpu cpufreq disk
337 + drbd entropy ethstat hugepages interface iptables
338 + ipvs irq ipc load memory md netlink nfs numa processes
339 + serial swap tcpconns thermal turbostat users vmem wireless
340 + zfc_arc"
341 +
342 + local need_libstatgrab=0
343 + local libstatgrab_plugins="cpu disk interface load memory swap users"
344 + local bsd_plugins="cpu tcpconns ${libstatgrab_plugins} zfc_arc"
345 +
346 + local darwin_plugins="apple_sensors battery cpu disk interface memory processes tcpconns"
347 +
348 + local osdependent_plugins="${linux_plugins} ${bsd_plugins} ${darwin_plugins}"
349 + local myos_plugins=""
350 + if use kernel_linux; then
351 + einfo "Enabling Linux plugins."
352 + myos_plugins=${linux_plugins}
353 + elif use kernel_FreeBSD; then
354 + einfo "Enabling FreeBSD plugins."
355 + myos_plugins=${bsd_plugins}
356 + elif use kernel_Darwin; then
357 + einfo "Enabling Darwin plugins."
358 + myos_plugins=${darwin_plugins}
359 + fi
360 +
361 + local myconf="--disable-werror"
362 +
363 + # Do we debug?
364 + myconf+=" $(use_enable debug)"
365 +
366 + # udev support?
367 + # Required for smart plugin via REQUIRED_USE; Optional for disk plugin
368 + if use udev; then
369 + myconf+=" --with-libudev"
370 + else
371 + myconf+=" --without-libudev"
372 + fi
373 +
374 + local plugin
375 +
376 + # Disable what needs to be disabled.
377 + for plugin in ${COLLECTD_DISABLED_PLUGINS}; do
378 + if [[ "${plugin}" == 'dpdkstat' ]]; then
379 + myconf+=" --without-libdpdk"
380 + else
381 + myconf+=" --disable-${plugin}"
382 + fi
383 + done
384 +
385 + # Set enable/disable for each single plugin.
386 + for plugin in ${COLLECTD_ALL_PLUGINS}; do
387 + if has ${plugin} ${osdependent_plugins}; then
388 + # plugin is os-dependent ...
389 + if has ${plugin} ${myos_plugins}; then
390 + # ... and available in this os
391 + myconf+=" $(use_enable collectd_plugins_${plugin} ${plugin})"
392 + # ... must we link against libstatgrab? Bug #541518
393 + if use kernel_FreeBSD && has ${plugin} ${libstatgrab_plugins}; then
394 + einfo "We must link against libstatgrab due to plugin \"${plugin}\" ..."
395 + need_libstatgrab=1
396 + fi
397 + else
398 + # ... and NOT available in this os
399 + if use collectd_plugins_${plugin}; then
400 + ewarn "You try to enable the ${plugin} plugin, but it is not available for this"
401 + ewarn "kernel. Disabling it automatically."
402 + fi
403 + myconf+=" --disable-${plugin}"
404 + fi
405 + elif [[ "${plugin}" = "collectd_plugins_perl" ]]; then
406 + if use collectd_plugins_perl && ! use perl; then
407 + ewarn "Perl plugin disabled as perl bindings disabled by -perl use flag"
408 + myconf+= --disable-perl
409 + else
410 + myconf+=" $(use_enable collectd_plugins_${plugin} ${plugin})"
411 + fi
412 + else
413 + myconf+=" $(use_enable collectd_plugins_${plugin} ${plugin})"
414 + fi
415 + done
416 +
417 + if [ "${need_libstatgrab}" -eq 1 ]; then
418 + myconf+=" --with-libstatgrab"
419 + else
420 + myconf+=" --without-libstatgrab"
421 + fi
422 +
423 + # JAVA_HOME is set by eclasses.
424 + if use collectd_plugins_java; then
425 + myconf+=" --with-java"
426 + fi
427 +
428 + # Need libiptc ONLY for iptables. If we try to use it otherwise bug 340109 happens.
429 + # lots of libs are only needed for plugins, if they are disabled, also disable the lib
430 + use collectd_plugins_iptables || myconf+=" --with-libiptc=no"
431 + use collectd_plugins_openldap || myconf+=" --with-libldap=no"
432 + use collectd_plugins_redis || use collectd_plugins_write_redis || myconf+=" --with-libhiredis=no"
433 + use collectd_plugins_smart || myconf+=" --with-libatasmart=no"
434 + use collectd_plugins_gps || myconf+=" --with-libgps=no"
435 +
436 + if use perl; then
437 + myconf+=" --with-perl-bindings=INSTALLDIRS=vendor"
438 + else
439 + myconf+=" --without-perl-bindings"
440 + fi
441 +
442 + # No need for v5upgrade
443 + myconf+=" --disable-target_v5upgrade"
444 +
445 + # Python
446 + if use collectd_plugins_python; then
447 + myconf+=" --with-libpython=yes"
448 + export PYTHON_CONFIG=$(python_get_PYTHON_CONFIG)
449 + else
450 + myconf+=" --with-libpython=no"
451 + fi
452 +
453 + # XFS support
454 + myconf+=" $(use_enable xfs)"
455 +
456 + # Finally, run econf.
457 + KERNEL_DIR="${KERNEL_DIR}" econf --config-cache \
458 + $(use_enable static-libs static) \
459 + --localstatedir=/var ${myconf}
460 +}
461 +
462 +src_install() {
463 + emake DESTDIR="${D%/}" install
464 +
465 + perl_delete_localpod
466 +
467 + find "${ED}"usr/ -name "*.la" -delete || die
468 +
469 + if use collectd_plugins_java; then
470 + java-pkg_regjar "${ED}"usr/share/${PN}/java/*.jar
471 + fi
472 +
473 + fowners root:collectd /etc/collectd.conf
474 + fperms u=rw,g=r,o= /etc/collectd.conf
475 +
476 + dodoc AUTHORS ChangeLog README
477 +
478 + if use contrib ; then
479 + insinto /usr/share/doc/${PF}
480 + doins -r contrib
481 + fi
482 +
483 + keepdir /var/lib/${PN}
484 + fowners collectd:collectd /var/lib/${PN}
485 +
486 + newinitd "${FILESDIR}/${PN}.initd-r2" ${PN}
487 + newconfd "${FILESDIR}/${PN}.confd-r2" ${PN}
488 + systemd_newunit "contrib/systemd.${PN}.service" ${PN}.service
489 +
490 + insinto /etc/logrotate.d
491 + newins "${FILESDIR}/${PN}.logrotate" ${PN}
492 +
493 + newtmpfiles "${FILESDIR}"/${PN}.tmpfile ${PN}.conf
494 +
495 + sed -i -e 's:^.*PIDFile "/var/run/collectd.pid":#PIDFile "/run/collectd.pid":' "${ED}"etc/collectd.conf || die
496 + sed -i -e 's:^# SocketFile "/var/run/collectd-unixsock":# SocketFile "/run/collectd/collectd.socket":' "${ED}"etc/collectd.conf || die
497 + sed -i -e 's:^.*LoadPlugin perl$:# The new, correct way to load the perl plugin -- \n# <LoadPlugin perl>\n# Globals true\n# </LoadPlugin>:' "${ED}"etc/collectd.conf || die
498 + sed -i -e 's:^.*LoadPlugin python$:# The new, correct way to load the python plugin -- \n# <LoadPlugin python>\n# Globals true\n# </LoadPlugin>:' "${ED}"etc/collectd.conf || die
499 +}
500 +
501 +pkg_postinst() {
502 + tmpfiles_process "${PN}.conf"
503 +
504 + if use filecaps; then
505 + local caps=()
506 + use collectd_plugins_ceph && caps+=('CAP_DAC_OVERRIDE')
507 + use collectd_plugins_exec && caps+=('CAP_SETUID' 'CAP_SETGID')
508 + use collectd_plugins_iptables && caps+=('CAP_NET_ADMIN')
509 + use collectd_plugins_filecount && caps+=('CAP_DAC_READ_SEARCH')
510 +
511 + if use collectd_plugins_dns || use collectd_plugins_ping; then
512 + caps+=('CAP_NET_RAW')
513 + fi
514 +
515 + if use collectd_plugins_turbostat || use collectd_plugins_smart; then
516 + caps+=('CAP_SYS_RAWIO')
517 + fi
518 +
519 + if [ ${#caps[@]} -gt 0 ]; then
520 + local caps_str=$(IFS=","; echo "${caps[*]}")
521 + fcaps ${caps_str} usr/sbin/collectd
522 + elog "Capabilities for ${EROOT}usr/sbin/collectd set to:"
523 + elog " ${caps_str}+EP"
524 + elog
525 +
526 + local systemd_unit="$(systemd_get_systemunitdir)/collectd.service"
527 + if [[ -e "${systemd_unit}" ]]; then
528 + caps_str="${caps[*]}"
529 + sed -i -e "s:^CapabilityBoundingSet=.*:CapabilityBoundingSet=${caps_str}:" "${systemd_unit}" || \
530 + die "Failed to set CapabilityBoundingSet in '${systemd_unit}'"
531 +
532 + elog "CapabilityBoundingSet in '${systemd_unit}'"
533 + elog "updated to match capabilities set above."
534 + elog
535 + else
536 + if has_version "sys-apps/systemd"; then
537 + # Bug 596852
538 + ewarn "Failed to update CapabilityBoundingSet in '${systemd_unit}'"
539 + ewarn "because unit was not found. Please file a bug about this."
540 + fi
541 + fi
542 + fi
543 + fi
544 +
545 + elog "Note: Collectd is only the collector."
546 + elog " You need to install 'data' sources (applications) locally or"
547 + elog " remotely on your own."
548 +
549 + elog
550 + elog "Collectd is configured to run as unprivileged user by default."
551 + elog "You may want to revisit the configuration."
552 + elog
553 +
554 + if use collectd_plugins_email; then
555 + ewarn "The email plug-in is deprecated. To submit statistics please use the unixsock plugin."
556 + fi
557 +
558 + if use collectd_plugins_smart; then
559 + elog ""
560 + elog "If you are using smart plugin and don't run collectd as root make sure"
561 + elog "that the collectd user is allowed to access the disk you want to monitor"
562 + elog "(can be done via udev rule for example) and that collectd has the required"
563 + elog "capabilities set (which is the default when package was emerged with"
564 + elog "'filecaps' USE flag set)."
565 + fi
566 +
567 + if use contrib; then
568 + elog "The scripts in /usr/share/doc/${PF}/collection3 for generating graphs need dev-perl/HTML-Parser,"
569 + elog "dev-perl/config-general, dev-perl/regexp-common, and net-analyzer/rrdtool[perl] to be installed."
570 + fi
571 +}