Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/net-snmp/files/, net-analyzer/net-snmp/
Date: Mon, 09 Sep 2019 06:58:11
Message-Id: 1568012283.8174e41dd01d980e7ec9f6f2f5dd9d13ed4a4676.jer@gentoo
1 commit: 8174e41dd01d980e7ec9f6f2f5dd9d13ed4a4676
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 9 06:56:41 2019 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 9 06:58:03 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8174e41d
7
8 net-analyzer/net-snmp: Add IUSE=pcap
9
10 Package-Manager: Portage-2.3.75, Repoman-2.3.17
11 Bug: https://bugs.gentoo.org/693854
12 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
13
14 .../net-snmp/files/net-snmp-5.8-pcap.patch | 41 +++++
15 net-analyzer/net-snmp/metadata.xml | 3 +-
16 net-analyzer/net-snmp/net-snmp-5.8-r3.ebuild | 205 +++++++++++++++++++++
17 3 files changed, 248 insertions(+), 1 deletion(-)
18
19 diff --git a/net-analyzer/net-snmp/files/net-snmp-5.8-pcap.patch b/net-analyzer/net-snmp/files/net-snmp-5.8-pcap.patch
20 new file mode 100644
21 index 00000000000..43692240acb
22 --- /dev/null
23 +++ b/net-analyzer/net-snmp/files/net-snmp-5.8-pcap.patch
24 @@ -0,0 +1,41 @@
25 +--- a/configure.d/config_project_with_enable
26 ++++ b/configure.d/config_project_with_enable
27 +@@ -1187,6 +1187,11 @@
28 + [],
29 + [with_bzip2="no"])
30 +
31 ++AC_ARG_WITH([pcap],
32 ++ [ --with-pcap[=DIR] use libpcap in DIR],
33 ++ [],
34 ++ [with_pcap="no"])
35 ++
36 + NETSNMP_ARG_WITH(
37 + [mnttab],
38 + AS_HELP_STRING(
39 +--- a/configure.d/config_os_libs2
40 ++++ b/configure.d/config_os_libs2
41 +@@ -583,14 +590,16 @@
42 + ##
43 + # libpcap
44 + ##
45 +-NETSNMP_BUILD_PCAP_PROG_TRUE='#'
46 +-NETSNMP_BUILD_PCAP_PROG_FALSE=''
47 +-AC_CHECK_LIB([pcap], [pcap_create], [
48 +- AC_CHECK_HEADERS([pcap/pcap.h], [
49 +- NETSNMP_BUILD_PCAP_PROG_TRUE=''
50 +- NETSNMP_BUILD_PCAP_PROG_FALSE='#'
51 +- ])
52 +-])
53 ++if test "x$with_pcap" = "xyes" ; then
54 ++ NETSNMP_BUILD_PCAP_PROG_TRUE='#'
55 ++ NETSNMP_BUILD_PCAP_PROG_FALSE=''
56 ++ AC_CHECK_LIB([pcap], [pcap_create], [
57 ++ AC_CHECK_HEADERS([pcap/pcap.h], [
58 ++ NETSNMP_BUILD_PCAP_PROG_TRUE=''
59 ++ NETSNMP_BUILD_PCAP_PROG_FALSE='#'
60 ++ ])
61 ++ ])
62 ++fi
63 + AC_SUBST(NETSNMP_BUILD_PCAP_PROG_TRUE)
64 + AC_SUBST(NETSNMP_BUILD_PCAP_PROG_FALSE)
65 +
66
67 diff --git a/net-analyzer/net-snmp/metadata.xml b/net-analyzer/net-snmp/metadata.xml
68 index 95e28946a27..f3f6819a536 100644
69 --- a/net-analyzer/net-snmp/metadata.xml
70 +++ b/net-analyzer/net-snmp/metadata.xml
71 @@ -10,10 +10,11 @@
72 <flag name="kmem">Enable usage of /dev/kmem</flag>
73 <flag name="mfd-rewrites">Use MFD rewrites of mib modules where available</flag>
74 <flag name="netlink">Use <pkg>dev-libs/libnl</pkg> to fetch TCP statistics instead of using /proc/net/tcp (Linux only).</flag>
75 +<flag name="pcap">Install snmppcap which reads from PCAP files and writes to the SNMP transport</flag>
76 <flag name="pci">Use libpci (from <pkg>sys-apps/pciutils</pkg>) to look up network interface description. This feature is only available on Linux.</flag>
77 <flag name="rpm">Enable monitoring of <pkg>app-arch/rpm</pkg>. This flag requires the bzip2 and zlib flags to be enabled as well.</flag>
78 -<flag name="ucd-compat">Build UCD compatibility library. Increases significantly the install size.</flag>
79 <flag name="smux">Enable support for the legacy smux protocol (superseded by agentx)</flag>
80 +<flag name="ucd-compat">Build UCD compatibility library. Increases significantly the install size.</flag>
81 </use>
82 <upstream>
83 <remote-id type="sourceforge">net-snmp</remote-id>
84
85 diff --git a/net-analyzer/net-snmp/net-snmp-5.8-r3.ebuild b/net-analyzer/net-snmp/net-snmp-5.8-r3.ebuild
86 new file mode 100644
87 index 00000000000..ff99cf4ad76
88 --- /dev/null
89 +++ b/net-analyzer/net-snmp/net-snmp-5.8-r3.ebuild
90 @@ -0,0 +1,205 @@
91 +# Copyright 1999-2019 Gentoo Authors
92 +# Distributed under the terms of the GNU General Public License v2
93 +
94 +EAPI=6
95 +PYTHON_COMPAT=( python2_7 )
96 +DISTUTILS_SINGLE_IMPL=yesplz
97 +DISTUTILS_OPTIONAL=yesplz
98 +WANT_AUTOMAKE=none
99 +PATCHSET=3
100 +GENTOO_DEPEND_ON_PERL=no
101 +
102 +inherit autotools distutils-r1 eutils perl-module systemd
103 +
104 +DESCRIPTION="Software for generating and retrieving SNMP data"
105 +HOMEPAGE="http://www.net-snmp.org/"
106 +SRC_URI="
107 + mirror://sourceforge/project/${PN}/${PN}/${PV/_p*/}/${P/_p*/}.tar.gz
108 + https://dev.gentoo.org/~jer/${PN}-5.7.3-patches-3.tar.xz
109 +"
110 +
111 +S=${WORKDIR}/${P/_/.}
112 +
113 +# GPL-2 for the init scripts
114 +LICENSE="HPND BSD GPL-2"
115 +SLOT="0/35"
116 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
117 +IUSE="
118 + X bzip2 doc elf kmem ipv6 libressl lm_sensors mfd-rewrites minimal mysql
119 + netlink pcap pci perl python rpm selinux smux ssl tcpd ucd-compat zlib
120 +"
121 +
122 +COMMON_DEPEND="
123 + bzip2? ( app-arch/bzip2 )
124 + elf? ( dev-libs/elfutils )
125 + lm_sensors? ( sys-apps/lm_sensors )
126 + mysql? ( dev-db/mysql-connector-c:0= )
127 + netlink? ( dev-libs/libnl:3 )
128 + pcap? ( net-libs/libpcap )
129 + pci? ( sys-apps/pciutils )
130 + perl? ( dev-lang/perl:= )
131 + python? (
132 + dev-python/setuptools[${PYTHON_USEDEP}]
133 + ${PYTHON_DEPS}
134 + )
135 + rpm? (
136 + app-arch/rpm
137 + dev-libs/popt
138 + )
139 + ssl? (
140 + !libressl? ( >=dev-libs/openssl-0.9.6d:0= )
141 + libressl? ( dev-libs/libressl:= )
142 + )
143 + tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
144 + zlib? ( >=sys-libs/zlib-1.1.4 )
145 +"
146 +DEPEND="
147 + ${COMMON_DEPEND}
148 + doc? ( app-doc/doxygen )
149 +"
150 +RDEPEND="
151 + ${COMMON_DEPEND}
152 + perl? (
153 + X? ( dev-perl/Tk )
154 + !minimal? ( dev-perl/TermReadKey )
155 + )
156 + selinux? ( sec-policy/selinux-snmp )
157 +"
158 +
159 +REQUIRED_USE="
160 + python? ( ${PYTHON_REQUIRED_USE} )
161 + rpm? ( bzip2 zlib )
162 +"
163 +S=${WORKDIR}/${P/_p*/}
164 +
165 +RESTRICT=test
166 +
167 +pkg_setup() {
168 + use python && python-single-r1_pkg_setup
169 +}
170 +
171 +src_prepare() {
172 + # snmpconf generates config files with proper selinux context
173 + use selinux && eapply "${FILESDIR}"/${PN}-5.1.2-snmpconf-selinux.patch
174 +
175 + eapply "${FILESDIR}"/${PN}-5.7.3-include-limits.patch
176 + eapply "${FILESDIR}"/${PN}-5.8-my_bool.patch
177 + eapply "${FILESDIR}"/${PN}-5.8-pcap.patch
178 + eapply "${FILESDIR}"/${PN}-5.8-tinfo.patch
179 +
180 + mv "${WORKDIR}"/patches/0002-Respect-DESTDIR-for-pythoninstall.patch{,.disabled} || die
181 + mv "${WORKDIR}"/patches/0004-Don-t-report-CFLAGS-and-LDFLAGS-in-net-snmp-config.patch{,.disabled} || die
182 + eapply "${WORKDIR}"/patches/*.patch
183 +
184 + eapply_user
185 +
186 + eautoconf
187 +}
188 +
189 +src_configure() {
190 + # keep this in the same line, configure.ac arguments are passed down to config.h
191 + local mibs="host ucd-snmp/dlmod ucd-snmp/diskio ucd-snmp/extensible mibII/mta_sendmail etherlike-mib/dot3StatsTable"
192 + use lm_sensors && mibs="${mibs} ucd-snmp/lmsensorsMib"
193 + use smux && mibs="${mibs} smux"
194 +
195 + # Assume /etc/mtab is not present with a recent baselayout/openrc (bug #565136)
196 + use kernel_linux && export ac_cv_ETC_MNTTAB=/etc/mtab
197 +
198 + econf \
199 + $(use_enable !ssl internal-md5) \
200 + $(use_enable ipv6) \
201 + $(use_enable mfd-rewrites) \
202 + $(use_enable perl embedded-perl) \
203 + $(use_enable ucd-compat ucd-snmp-compatibility) \
204 + $(use_with bzip2) \
205 + $(use_with elf) \
206 + $(use_with kmem kmem-usage) \
207 + $(use_with mysql) \
208 + $(use_with netlink nl) \
209 + $(use_with pcap) \
210 + $(use_with pci) \
211 + $(use_with perl perl-modules INSTALLDIRS=vendor) \
212 + $(use_with python python-modules) \
213 + $(use_with rpm) \
214 + $(use_with ssl openssl) \
215 + $(use_with tcpd libwrap) \
216 + $(use_with zlib) \
217 + --enable-shared --disable-static \
218 + --with-default-snmp-version="3" \
219 + --with-install-prefix="${D}" \
220 + --with-ldflags="${LDFLAGS}" \
221 + --with-logfile="/var/log/net-snmpd.log" \
222 + --with-mib-modules="${mibs}" \
223 + --with-persistent-directory="/var/lib/net-snmp" \
224 + --with-sys-contact="root@Unknown" \
225 + --with-sys-location="Unknown"
226 +}
227 +
228 +src_compile() {
229 + for target in snmplib agent sedscript all; do
230 + emake OTHERLDFLAGS="${LDFLAGS}" ${target}
231 + done
232 +
233 + use doc && emake docsdox
234 +}
235 +
236 +src_install () {
237 + # bug #317965
238 + emake -j1 DESTDIR="${D}" install
239 +
240 + if use perl ; then
241 + perl_delete_localpod
242 + if ! use X; then
243 + rm "${D}"/usr/bin/tkmib || die
244 + fi
245 + else
246 + rm -f \
247 + "${D}"/usr/bin/fixproc \
248 + "${D}"/usr/bin/ipf-mod.pl \
249 + "${D}"/usr/bin/mib2c \
250 + "${D}"/usr/bin/net-snmp-cert \
251 + "${D}"/usr/bin/snmp-bridge-mib \
252 + "${D}"/usr/bin/snmpcheck \
253 + "${D}"/usr/bin/snmpconf \
254 + "${D}"/usr/bin/tkmib \
255 + "${D}"/usr/bin/traptoemail \
256 + "${D}"/usr/share/snmp/mib2c.perl.conf \
257 + "${D}"/usr/share/snmp/snmp_perl_trapd.pl \
258 + || die
259 + fi
260 +
261 + dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO
262 + newdoc EXAMPLE.conf.def EXAMPLE.conf
263 +
264 + if use doc; then
265 + docinto html
266 + dodoc -r docs/html/*
267 + fi
268 +
269 + keepdir /var/lib/net-snmp
270 +
271 + newinitd "${FILESDIR}"/snmpd.init.2 snmpd
272 + newconfd "${FILESDIR}"/snmpd.conf snmpd
273 +
274 + newinitd "${FILESDIR}"/snmptrapd.init.2 snmptrapd
275 + newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd
276 +
277 + systemd_dounit "${FILESDIR}"/snmpd.service
278 + systemd_dounit "${FILESDIR}"/snmptrapd.service
279 +
280 + insinto /etc/snmp
281 + newins "${S}"/EXAMPLE.conf snmpd.conf.example
282 +
283 + # Remove everything not required for an agent.
284 + # Keep only the snmpd, snmptrapd, MIBs, headers and libraries.
285 + if use minimal; then
286 + rm -rf \
287 + "${D}"/**/*.pl \
288 + "${D}"/usr/bin/{encode_keychange,snmp{get,getnext,set,usm,walk,bulkwalk,table,trap,bulkget,translate,status,delta,test,df,vacm,netstat,inform,check,conf},fixproc,traptoemail} \
289 + "${D}"/usr/share/snmp/*.conf \
290 + "${D}"/usr/share/snmp/snmpconf-data \
291 + || die
292 + fi
293 +
294 + prune_libtool_files
295 +}