Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-plugins/
Date: Sat, 06 Aug 2022 13:04:27
Message-Id: 1659790877.cfa457c454509372a7cd9ba0d11e144f63a75e38.mjo@gentoo
1 commit: cfa457c454509372a7cd9ba0d11e144f63a75e38
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 6 12:57:14 2022 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 6 13:01:17 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cfa457c4
7
8 net-analyzer/nagios-plugins: new revision with -fno-strict-aliasing.
9
10 The code for the check_ntp plugin violates the strict aliasing rules of
11 C, even though -fstrict-aliasing is enabled with -O2. First impression:
12 it won't be easy to fix. So to prevent surprises, we append
13 -fno-strict-aliasing to CFLAGS when it is supported.
14
15 Closes: https://bugs.gentoo.org/861200
16 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
17
18 .../nagios-plugins/nagios-plugins-2.4.0-r1.ebuild | 120 +++++++++++++++++++++
19 1 file changed, 120 insertions(+)
20
21 diff --git a/net-analyzer/nagios-plugins/nagios-plugins-2.4.0-r1.ebuild b/net-analyzer/nagios-plugins/nagios-plugins-2.4.0-r1.ebuild
22 new file mode 100644
23 index 000000000000..732d59f1bb73
24 --- /dev/null
25 +++ b/net-analyzer/nagios-plugins/nagios-plugins-2.4.0-r1.ebuild
26 @@ -0,0 +1,120 @@
27 +# Copyright 1999-2022 Gentoo Authors
28 +# Distributed under the terms of the GNU General Public License v2
29 +
30 +EAPI=8
31 +
32 +inherit flag-o-matic
33 +
34 +DESCRIPTION="Official plugins for Nagios"
35 +HOMEPAGE="https://nagios-plugins.org/"
36 +SRC_URI="https://github.com/${PN}/${PN}/releases/download/release-${PV}/${P}.tar.gz"
37 +
38 +LICENSE="GPL-2"
39 +SLOT="0"
40 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
41 +IUSE="ipv6 ldap mysql nagios-dns nagios-ping nagios-game postgres radius samba selinux snmp ssh +ssl"
42 +
43 +# Most of the plugins use automagic dependencies, i.e. the plugin will
44 +# get built if the binary it uses is installed. For example, check_snmp
45 +# will be built only if snmpget from net-analyzer/net-snmp[-minimal] is
46 +# installed. End result: most of our runtime dependencies are required
47 +# at build time as well.
48 +AUTOMAGIC_DEPEND="
49 + nagios-dns? ( net-dns/bind-tools )
50 + nagios-game? ( games-util/qstat )
51 + nagios-ping? ( net-analyzer/fping )
52 + samba? ( net-fs/samba )
53 + ssh? ( net-misc/openssh )
54 + snmp? ( dev-perl/Net-SNMP
55 + net-analyzer/net-snmp[-minimal] )"
56 +
57 +# Perl really needs to run during the build...
58 +BDEPEND="${AUTOMAGIC_DEPEND}
59 + dev-lang/perl"
60 +
61 +DEPEND="
62 + ldap? ( net-nds/openldap:= )
63 + mysql? ( dev-db/mysql-connector-c:= )
64 + postgres? ( dev-db/postgresql:* )
65 + ssl? (
66 + dev-libs/openssl:0=
67 + )
68 + radius? ( net-dialup/freeradius-client )"
69 +
70 +# Basically everything in net-analyzer/monitoring-plugins collides with
71 +# nagios-plugins. Perl (from BDEPEND) is needed at runtime, too.
72 +RDEPEND="${BDEPEND}
73 + ${DEPEND}
74 + !net-analyzer/monitoring-plugins
75 + selinux? ( sec-policy/selinux-nagios )"
76 +
77 +# At least one test is interactive.
78 +RESTRICT="test"
79 +
80 +DOCS=(
81 + ACKNOWLEDGEMENTS
82 + AUTHORS
83 + CODING
84 + ChangeLog
85 + FAQ
86 + NEWS
87 + README
88 + REQUIREMENTS
89 + SUPPORT
90 + THANKS
91 +)
92 +
93 +PATCHES=(
94 + "${FILESDIR}/define-own-mysql-port-constant.patch"
95 +)
96 +
97 +src_prepare() {
98 + default
99 +
100 + # Fix the path to our perl interpreter
101 + sed -i -e "1s:/usr/local/bin/perl:/usr/bin/perl:" \
102 + "${S}"/plugins-scripts/*.pl \
103 + || die 'failed to fix perl interpreter path'
104 +}
105 +
106 +src_configure() {
107 + # Disable -fstrict-aliasing until check_ntp can be fixed,
108 + # https://github.com/nagios-plugins/nagios-plugins/issues/665
109 + append-cflags $(test-flags-CC -fno-strict-aliasing)
110 +
111 + # Use an array to prevent econf from mangling the ping args.
112 + local myconf=()
113 +
114 + if use ssl; then
115 + myconf+=( $(use_with ssl openssl /usr) )
116 + else
117 + myconf+=( --without-openssl )
118 + myconf+=( --without-gnutls )
119 + fi
120 +
121 + # The autodetection for these two commands can hang if localhost is
122 + # down or ICMP traffic is filtered. Bug #468296.
123 + myconf+=( --with-ping-command="/bin/ping -n -U -w %d -c %d %s" )
124 +
125 + if use ipv6; then
126 + myconf+=( --with-ping6-command="/bin/ping6 -n -U -w %d -c %d %s" )
127 + fi
128 +
129 + econf \
130 + $(use_with mysql) \
131 + $(use_with ipv6) \
132 + $(use_with ldap) \
133 + $(use_with postgres pgsql /usr) \
134 + $(use_with radius) \
135 + "${myconf[@]}" \
136 + --libexecdir="/usr/$(get_libdir)/nagios/plugins" \
137 + --sysconfdir="/etc/nagios"
138 +}
139 +
140 +pkg_postinst() {
141 + elog "This ebuild has a number of USE flags that determine what you"
142 + elog "are able to monitor. Depending on what you want to monitor, some"
143 + elog "or all of these USE flags need to be set."
144 + elog
145 + elog "The plugins are installed in ${ROOT}/usr/$(get_libdir)/nagios/plugins"
146 +}