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