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