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