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: Sat, 26 Aug 2017 11:33:04
Message-Id: 1503747180.b1e51e769ea330c59b24d3ea0f0590e2094efaf1.jer@gentoo
1 commit: b1e51e769ea330c59b24d3ea0f0590e2094efaf1
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 26 11:32:44 2017 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 26 11:33:00 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b1e51e76
7
8 net-analyzer/net-snmp: Fix MySQL bindings by Peter Levine (bug #627588).
9
10 Package-Manager: Portage-2.3.8, Repoman-2.3.3
11
12 net-analyzer/net-snmp/Manifest | 1 +
13 .../files/net-snmp-5.7.3-mariadb-10.2.patch | 37 ++++
14 .../net-snmp/files/net-snmp-5.7.3-perl524-2.patch | 70 ++++++++
15 net-analyzer/net-snmp/net-snmp-5.7.3_p3.ebuild | 197 +++++++++++++++++++++
16 4 files changed, 305 insertions(+)
17
18 diff --git a/net-analyzer/net-snmp/Manifest b/net-analyzer/net-snmp/Manifest
19 index 021996c9aab..0d12b994b0e 100644
20 --- a/net-analyzer/net-snmp/Manifest
21 +++ b/net-analyzer/net-snmp/Manifest
22 @@ -1,4 +1,5 @@
23 DIST net-snmp-5.7.3-patches-2.tar.xz 3312 SHA256 a72732f9e40988ef1d79b6750c7ef7f56accbf5a32543dd15c000e58b1e9054c SHA512 22ca6cc4dd1fd58a8cff53881d248155dbfdab765e9a3664320c8c4a5cfa35e741adfb0304bb38be7719ba1c7418f9b0f9178719951b82d70257c3c944c450ad WHIRLPOOL 509da418db4c380f431af1d2d342bea4bd18caad99f2fb8120466ffcbbe8d2e09702a28b43b59d2a633ae3566d599a82a221eae4e9ac601a545445c614d3459f
24 +DIST net-snmp-5.7.3-patches-3.tar.xz 3176 SHA256 0c3c307b4dc2d068d34f9743f8b8897a9dc53c19056dad809658aaedffff682d SHA512 d8a91b9668320a1e19d062eb86dd4d16beb7c2d15ac7ebbb9d2a4bd298af39bbb0a2613504dbb0057cccdec731f08f2308c5a15395e1fbc29bb0611ed8aca636 WHIRLPOOL e72cabfeada32a17e4962417466f5e19548a1ef3ab213ecb6d7865ad4f8d26f7b9a33b0c6db9996c70c947300037a0bbcae73d2793044f352bebb7849659aa49
25 DIST net-snmp-5.7.3-perl524-2.patch.gz 523 SHA256 237e34a5de032c2173de836ef694583d144717b3441903a7c52f409c0038ca08 SHA512 bede47234b809d67f33c46654f3d09d0b255d835fb97eea23bfa888922dfb80ad287c305596a6b041ed03ec91dc7c647ecd54c3c79e0b4ce08978332de3cc007 WHIRLPOOL c81e8dd2234b090c48e1adfa075d5817263364ade0e39e59c2ecf99e1a3862e6eac70cbfc7eef592de12ecc02d66baf9ae651e2f085936dde4d38f975aef0aed
26 DIST net-snmp-5.7.3-perl524.patch.gz 9072 SHA256 e8dfa8546aafc4afa03f8e26d330b92f22ded0674c68a4083bd3c8fb9ad5a418 SHA512 2d3184ac7c96f75af5bf8c8d23f33d5636c701e052a638e5403a8d5aa34985abc38f6a366ba09a1d8499a05fd71d939a7ed4d530661e56a726386603b6f6e6a4 WHIRLPOOL de180f600feeb94ae1cfd6b2e74f96c59618bc0696938e96d93163cd3b0a33c5426bbc2e6523b75cdaadf10018c07806cc8bd79f9c94593633915b33a2d6278a
27 DIST net-snmp-5.7.3.tar.gz 6382428 SHA256 12ef89613c7707dc96d13335f153c1921efc9d61d3708ef09f3fc4a7014fb4f0 SHA512 0758bba5844cfd6c80959ac16b83906a2f830ba49fd0ab1bf9e191dc6a79d312a2e4760bd53b3e1a1c82759481f0064d088d5a3cf475d84b25679a6bd0f049bb WHIRLPOOL ee741c1278206dd8dae00e085629e7c13ce518ad1911af804872ccaba576ab4d234f7801dbb447ae1ddba8196d43d1dbcd46c4bd8f69aa9dc9eb1662ce5e718a
28
29 diff --git a/net-analyzer/net-snmp/files/net-snmp-5.7.3-mariadb-10.2.patch b/net-analyzer/net-snmp/files/net-snmp-5.7.3-mariadb-10.2.patch
30 new file mode 100644
31 index 00000000000..8660a325756
32 --- /dev/null
33 +++ b/net-analyzer/net-snmp/files/net-snmp-5.7.3-mariadb-10.2.patch
34 @@ -0,0 +1,37 @@
35 +--- a/apps/snmptrapd_sql.c
36 ++++ b/apps/snmptrapd_sql.c
37 +@@ -54,6 +54,7 @@
38 + #include <my_sys.h>
39 + #include <mysql.h>
40 + #include <errmsg.h>
41 ++#include <mysql_version.h>
42 +
43 + netsnmp_feature_require(container_fifo)
44 +
45 +@@ -437,6 +438,7 @@ netsnmp_mysql_init(void)
46 + return -1;
47 + }
48 +
49 ++#if MYSQL_VERSION_ID < 100000
50 + #ifdef HAVE_BROKEN_LIBMYSQLCLIENT
51 + my_init();
52 + #else
53 +@@ -445,6 +447,7 @@ netsnmp_mysql_init(void)
54 +
55 + /** load .my.cnf values */
56 + load_defaults ("my", _sql.groups, &not_argc, &not_argv);
57 ++#endif
58 + for(i=0; i < not_argc; ++i) {
59 + if (NULL == not_argv[i])
60 + continue;
61 +@@ -542,6 +545,10 @@ netsnmp_mysql_init(void)
62 + return -1;
63 + }
64 +
65 ++#if MYSQL_VERSION_ID > 100000
66 ++ mysql_options(_sql.conn, MYSQL_READ_DEFAULT_GROUP, "snmptrapd");
67 ++#endif
68 ++
69 + /** try to connect; we'll try again later if we fail */
70 + (void) netsnmp_mysql_connect();
71 +
72
73 diff --git a/net-analyzer/net-snmp/files/net-snmp-5.7.3-perl524-2.patch b/net-analyzer/net-snmp/files/net-snmp-5.7.3-perl524-2.patch
74 new file mode 100644
75 index 00000000000..45855597a86
76 --- /dev/null
77 +++ b/net-analyzer/net-snmp/files/net-snmp-5.7.3-perl524-2.patch
78 @@ -0,0 +1,70 @@
79 +--- a/perl/ASN/Makefile.PL
80 ++++ b/perl/ASN/Makefile.PL
81 +@@ -1,3 +1,4 @@
82 ++package ASN;
83 + use ExtUtils::MakeMaker;
84 + require 5;
85 + use Config;
86 +--- a/perl/AnyData_SNMP/Makefile.PL
87 ++++ b/perl/AnyData_SNMP/Makefile.PL
88 +@@ -1,3 +1,4 @@
89 ++package AnyData_SNMP;
90 + use ExtUtils::MakeMaker;
91 + # See lib/ExtUtils/MakeMaker.pm for details of how to influence
92 + # the contents of the Makefile that is written.
93 +--- a/perl/OID/Makefile.PL
94 ++++ b/perl/OID/Makefile.PL
95 +@@ -1,3 +1,4 @@
96 ++package OID;
97 + # See lib/ExtUtils/MakeMaker.pm for details of how to influence
98 + # the contents of the Makefile that is written.
99 +
100 +--- a/perl/SNMP/Makefile.PL
101 ++++ b/perl/SNMP/Makefile.PL
102 +@@ -1,3 +1,4 @@
103 ++package SNMP;
104 + use ExtUtils::MakeMaker;
105 + require 5;
106 + use Config;
107 +--- a/perl/TrapReceiver/Makefile.PL
108 ++++ b/perl/TrapReceiver/Makefile.PL
109 +@@ -1,3 +1,4 @@
110 ++package TrapReceiver;
111 + use ExtUtils::MakeMaker;
112 + require 5;
113 + use Config;
114 +--- a/perl/agent/Makefile.PL
115 ++++ b/perl/agent/Makefile.PL
116 +@@ -1,3 +1,4 @@
117 ++package agent;
118 + use ExtUtils::MakeMaker;
119 + require 5;
120 + use Config;
121 +--- a/perl/agent/Support/Makefile.PL
122 ++++ b/perl/agent/Support/Makefile.PL
123 +@@ -1,3 +1,4 @@
124 ++package agent_Support;
125 + use ExtUtils::MakeMaker;
126 + require 5;
127 + use Config;
128 +--- a/perl/agent/default_store/Makefile.PL
129 ++++ b/perl/agent/default_store/Makefile.PL
130 +@@ -1,3 +1,4 @@
131 ++package agent_default_store;
132 + use ExtUtils::MakeMaker;
133 + require 5;
134 + use Config;
135 +--- a/perl/default_store/Makefile.PL
136 ++++ b/perl/default_store/Makefile.PL
137 +@@ -1,3 +1,4 @@
138 ++package default_store;
139 + use ExtUtils::MakeMaker;
140 + require 5;
141 + use Config;
142 +--- a/perl/manager/Makefile.PL
143 ++++ b/perl/manager/Makefile.PL
144 +@@ -1,3 +1,4 @@
145 ++package manager;
146 + use ExtUtils::MakeMaker;
147 + # See lib/ExtUtils/MakeMaker.pm for details of how to influence
148 + # the contents of the Makefile that is written.
149
150 diff --git a/net-analyzer/net-snmp/net-snmp-5.7.3_p3.ebuild b/net-analyzer/net-snmp/net-snmp-5.7.3_p3.ebuild
151 new file mode 100644
152 index 00000000000..4175fec18f2
153 --- /dev/null
154 +++ b/net-analyzer/net-snmp/net-snmp-5.7.3_p3.ebuild
155 @@ -0,0 +1,197 @@
156 +# Copyright 1999-2017 Gentoo Foundation
157 +# Distributed under the terms of the GNU General Public License v2
158 +
159 +EAPI=6
160 +PYTHON_COMPAT=( python2_7 )
161 +DISTUTILS_SINGLE_IMPL=yesplz
162 +DISTUTILS_OPTIONAL=yesplz
163 +WANT_AUTOMAKE=none
164 +PATCHSET=3
165 +GENTOO_DEPEND_ON_PERL=no
166 +
167 +inherit autotools distutils-r1 eutils perl-module systemd
168 +
169 +DESCRIPTION="Software for generating and retrieving SNMP data"
170 +HOMEPAGE="http://net-snmp.sourceforge.net/"
171 +SRC_URI="
172 + mirror://sourceforge/project/${PN}/${PN}/${PV/_p*/}/${P/_p*/}.tar.gz
173 + https://dev.gentoo.org/~jer/${PN}-5.7.3-patches-${PV/*_p/}.tar.xz
174 + https://dev.gentoo.org/~dilfridge/distfiles/${P/_p*/}-perl524.patch.gz
175 +"
176 +
177 +S=${WORKDIR}/${P/_/.}
178 +
179 +# GPL-2 for the init scripts
180 +LICENSE="HPND BSD GPL-2"
181 +SLOT="0"
182 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
183 +IUSE="X bzip2 doc elf ipv6 libressl lm_sensors mfd-rewrites minimal mysql netlink pci perl python rpm selinux smux ssl tcpd ucd-compat zlib"
184 +
185 +COMMON_DEPEND="
186 + ssl? (
187 + !libressl? ( >=dev-libs/openssl-0.9.6d:0 )
188 + libressl? ( dev-libs/libressl )
189 + )
190 + tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
191 + rpm? (
192 + app-arch/rpm
193 + dev-libs/popt
194 + )
195 + bzip2? ( app-arch/bzip2 )
196 + zlib? ( >=sys-libs/zlib-1.1.4 )
197 + elf? ( dev-libs/elfutils )
198 + python? (
199 + dev-python/setuptools[${PYTHON_USEDEP}]
200 + ${PYTHON_DEPS}
201 + )
202 + pci? ( sys-apps/pciutils )
203 + lm_sensors? ( sys-apps/lm_sensors )
204 + netlink? ( dev-libs/libnl:3 )
205 + mysql? ( virtual/mysql )
206 + perl? ( dev-lang/perl:= )
207 +"
208 +DEPEND="
209 + ${COMMON_DEPEND}
210 + doc? ( app-doc/doxygen )
211 +"
212 +RDEPEND="
213 + ${COMMON_DEPEND}
214 + perl? (
215 + X? ( dev-perl/Tk )
216 + !minimal? ( dev-perl/TermReadKey )
217 + )
218 + selinux? ( sec-policy/selinux-snmp )
219 +"
220 +
221 +REQUIRED_USE="
222 + python? ( ${PYTHON_REQUIRED_USE} )
223 + rpm? ( bzip2 zlib )
224 +"
225 +S=${WORKDIR}/${P/_p*/}
226 +
227 +RESTRICT=test
228 +
229 +pkg_setup() {
230 + use python && python-single-r1_pkg_setup
231 +}
232 +
233 +src_prepare() {
234 + # snmpconf generates config files with proper selinux context
235 + use selinux && eapply "${FILESDIR}"/${PN}-5.1.2-snmpconf-selinux.patch
236 +
237 + eapply "${WORKDIR}"/${PN}-5.7.3-perl524.patch
238 + eapply "${FILESDIR}"/${PN}-5.7.3-perl524-2.patch
239 + eapply "${FILESDIR}"/${PN}-5.7.3-mariadb-10.2.patch
240 +
241 + eapply "${WORKDIR}"/patches/*.patch
242 +
243 + eapply_user
244 +
245 + eautoconf
246 +}
247 +
248 +src_configure() {
249 + # keep this in the same line, configure.ac arguments are passed down to config.h
250 + local mibs="host ucd-snmp/dlmod ucd-snmp/diskio ucd-snmp/extensible mibII/mta_sendmail etherlike-mib/dot3StatsTable"
251 + use lm_sensors && mibs="${mibs} ucd-snmp/lmsensorsMib"
252 + use smux && mibs="${mibs} smux"
253 +
254 + # Assume /etc/mtab is not present with a recent baselayout/openrc (bug #565136)
255 + use kernel_linux && export ac_cv_ETC_MNTTAB=/etc/mtab
256 +
257 + econf \
258 + $(use_enable !ssl internal-md5) \
259 + $(use_enable ipv6) \
260 + $(use_enable mfd-rewrites) \
261 + $(use_enable perl embedded-perl) \
262 + $(use_enable ucd-compat ucd-snmp-compatibility) \
263 + $(use_with bzip2) \
264 + $(use_with elf) \
265 + $(use_with mysql) \
266 + $(use_with netlink nl) \
267 + $(use_with pci) \
268 + $(use_with perl perl-modules INSTALLDIRS=vendor) \
269 + $(use_with python python-modules) \
270 + $(use_with rpm) \
271 + $(use_with ssl openssl) \
272 + $(use_with tcpd libwrap) \
273 + $(use_with zlib) \
274 + --enable-shared --disable-static \
275 + --with-default-snmp-version="3" \
276 + --with-install-prefix="${D}" \
277 + --with-ldflags="${LDFLAGS}" \
278 + --with-logfile="/var/log/net-snmpd.log" \
279 + --with-mib-modules="${mibs}" \
280 + --with-persistent-directory="/var/lib/net-snmp" \
281 + --with-sys-contact="root@Unknown" \
282 + --with-sys-location="Unknown"
283 +}
284 +
285 +src_compile() {
286 + for target in snmplib agent sedscript all; do
287 + emake OTHERLDFLAGS="${LDFLAGS}" ${target}
288 + done
289 +
290 + use doc && emake docsdox
291 +}
292 +
293 +src_install () {
294 + # bug #317965
295 + emake -j1 DESTDIR="${D}" install
296 +
297 + if use perl ; then
298 + perl_delete_localpod
299 + if ! use X; then
300 + rm "${D}"/usr/bin/tkmib || die
301 + fi
302 + else
303 + rm -f \
304 + "${D}"/usr/bin/fixproc \
305 + "${D}"/usr/bin/ipf-mod.pl \
306 + "${D}"/usr/bin/mib2c \
307 + "${D}"/usr/bin/net-snmp-cert \
308 + "${D}"/usr/bin/snmp-bridge-mib \
309 + "${D}"/usr/bin/snmpcheck \
310 + "${D}"/usr/bin/snmpconf \
311 + "${D}"/usr/bin/tkmib \
312 + "${D}"/usr/bin/traptoemail \
313 + "${D}"/usr/share/snmp/mib2c.perl.conf \
314 + "${D}"/usr/share/snmp/snmp_perl_trapd.pl \
315 + || die
316 + fi
317 +
318 + dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO
319 + newdoc EXAMPLE.conf.def EXAMPLE.conf
320 +
321 + if use doc; then
322 + docinto html
323 + dodoc -r docs/html/*
324 + fi
325 +
326 + keepdir /var/lib/net-snmp
327 +
328 + newinitd "${FILESDIR}"/snmpd.init.2 snmpd
329 + newconfd "${FILESDIR}"/snmpd.conf snmpd
330 +
331 + newinitd "${FILESDIR}"/snmptrapd.init.2 snmptrapd
332 + newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd
333 +
334 + systemd_dounit "${FILESDIR}"/snmpd.service
335 + systemd_dounit "${FILESDIR}"/snmptrapd.service
336 +
337 + insinto /etc/snmp
338 + newins "${S}"/EXAMPLE.conf snmpd.conf.example
339 +
340 + # Remove everything not required for an agent.
341 + # Keep only the snmpd, snmptrapd, MIBs, headers and libraries.
342 + if use minimal; then
343 + rm -rf \
344 + "${D}"/**/*.pl \
345 + "${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} \
346 + "${D}"/usr/share/snmp/*.conf \
347 + "${D}"/usr/share/snmp/snmpconf-data \
348 + || die
349 + fi
350 +
351 + prune_libtool_files
352 +}