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