net-analyzer/net-snmp: Fix MySQL bindings by Peter Levine (bug #627588).

Package-Manager: Portage-2.3.8, Repoman-2.3.3
This commit is contained in:
Jeroen Roovers
2017-08-26 13:32:44 +02:00
parent 3fdd4fa407
commit b1e51e769e
4 changed files with 305 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
DIST net-snmp-5.7.3-patches-2.tar.xz 3312 SHA256 a72732f9e40988ef1d79b6750c7ef7f56accbf5a32543dd15c000e58b1e9054c SHA512 22ca6cc4dd1fd58a8cff53881d248155dbfdab765e9a3664320c8c4a5cfa35e741adfb0304bb38be7719ba1c7418f9b0f9178719951b82d70257c3c944c450ad WHIRLPOOL 509da418db4c380f431af1d2d342bea4bd18caad99f2fb8120466ffcbbe8d2e09702a28b43b59d2a633ae3566d599a82a221eae4e9ac601a545445c614d3459f
DIST net-snmp-5.7.3-patches-3.tar.xz 3176 SHA256 0c3c307b4dc2d068d34f9743f8b8897a9dc53c19056dad809658aaedffff682d SHA512 d8a91b9668320a1e19d062eb86dd4d16beb7c2d15ac7ebbb9d2a4bd298af39bbb0a2613504dbb0057cccdec731f08f2308c5a15395e1fbc29bb0611ed8aca636 WHIRLPOOL e72cabfeada32a17e4962417466f5e19548a1ef3ab213ecb6d7865ad4f8d26f7b9a33b0c6db9996c70c947300037a0bbcae73d2793044f352bebb7849659aa49
DIST net-snmp-5.7.3-perl524-2.patch.gz 523 SHA256 237e34a5de032c2173de836ef694583d144717b3441903a7c52f409c0038ca08 SHA512 bede47234b809d67f33c46654f3d09d0b255d835fb97eea23bfa888922dfb80ad287c305596a6b041ed03ec91dc7c647ecd54c3c79e0b4ce08978332de3cc007 WHIRLPOOL c81e8dd2234b090c48e1adfa075d5817263364ade0e39e59c2ecf99e1a3862e6eac70cbfc7eef592de12ecc02d66baf9ae651e2f085936dde4d38f975aef0aed
DIST net-snmp-5.7.3-perl524.patch.gz 9072 SHA256 e8dfa8546aafc4afa03f8e26d330b92f22ded0674c68a4083bd3c8fb9ad5a418 SHA512 2d3184ac7c96f75af5bf8c8d23f33d5636c701e052a638e5403a8d5aa34985abc38f6a366ba09a1d8499a05fd71d939a7ed4d530661e56a726386603b6f6e6a4 WHIRLPOOL de180f600feeb94ae1cfd6b2e74f96c59618bc0696938e96d93163cd3b0a33c5426bbc2e6523b75cdaadf10018c07806cc8bd79f9c94593633915b33a2d6278a
DIST net-snmp-5.7.3.tar.gz 6382428 SHA256 12ef89613c7707dc96d13335f153c1921efc9d61d3708ef09f3fc4a7014fb4f0 SHA512 0758bba5844cfd6c80959ac16b83906a2f830ba49fd0ab1bf9e191dc6a79d312a2e4760bd53b3e1a1c82759481f0064d088d5a3cf475d84b25679a6bd0f049bb WHIRLPOOL ee741c1278206dd8dae00e085629e7c13ce518ad1911af804872ccaba576ab4d234f7801dbb447ae1ddba8196d43d1dbcd46c4bd8f69aa9dc9eb1662ce5e718a

View File

@@ -0,0 +1,37 @@
--- a/apps/snmptrapd_sql.c
+++ b/apps/snmptrapd_sql.c
@@ -54,6 +54,7 @@
#include <my_sys.h>
#include <mysql.h>
#include <errmsg.h>
+#include <mysql_version.h>
netsnmp_feature_require(container_fifo)
@@ -437,6 +438,7 @@ netsnmp_mysql_init(void)
return -1;
}
+#if MYSQL_VERSION_ID < 100000
#ifdef HAVE_BROKEN_LIBMYSQLCLIENT
my_init();
#else
@@ -445,6 +447,7 @@ netsnmp_mysql_init(void)
/** load .my.cnf values */
load_defaults ("my", _sql.groups, &not_argc, &not_argv);
+#endif
for(i=0; i < not_argc; ++i) {
if (NULL == not_argv[i])
continue;
@@ -542,6 +545,10 @@ netsnmp_mysql_init(void)
return -1;
}
+#if MYSQL_VERSION_ID > 100000
+ mysql_options(_sql.conn, MYSQL_READ_DEFAULT_GROUP, "snmptrapd");
+#endif
+
/** try to connect; we'll try again later if we fail */
(void) netsnmp_mysql_connect();

View File

@@ -0,0 +1,70 @@
--- a/perl/ASN/Makefile.PL
+++ b/perl/ASN/Makefile.PL
@@ -1,3 +1,4 @@
+package ASN;
use ExtUtils::MakeMaker;
require 5;
use Config;
--- a/perl/AnyData_SNMP/Makefile.PL
+++ b/perl/AnyData_SNMP/Makefile.PL
@@ -1,3 +1,4 @@
+package AnyData_SNMP;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
--- a/perl/OID/Makefile.PL
+++ b/perl/OID/Makefile.PL
@@ -1,3 +1,4 @@
+package OID;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
--- a/perl/SNMP/Makefile.PL
+++ b/perl/SNMP/Makefile.PL
@@ -1,3 +1,4 @@
+package SNMP;
use ExtUtils::MakeMaker;
require 5;
use Config;
--- a/perl/TrapReceiver/Makefile.PL
+++ b/perl/TrapReceiver/Makefile.PL
@@ -1,3 +1,4 @@
+package TrapReceiver;
use ExtUtils::MakeMaker;
require 5;
use Config;
--- a/perl/agent/Makefile.PL
+++ b/perl/agent/Makefile.PL
@@ -1,3 +1,4 @@
+package agent;
use ExtUtils::MakeMaker;
require 5;
use Config;
--- a/perl/agent/Support/Makefile.PL
+++ b/perl/agent/Support/Makefile.PL
@@ -1,3 +1,4 @@
+package agent_Support;
use ExtUtils::MakeMaker;
require 5;
use Config;
--- a/perl/agent/default_store/Makefile.PL
+++ b/perl/agent/default_store/Makefile.PL
@@ -1,3 +1,4 @@
+package agent_default_store;
use ExtUtils::MakeMaker;
require 5;
use Config;
--- a/perl/default_store/Makefile.PL
+++ b/perl/default_store/Makefile.PL
@@ -1,3 +1,4 @@
+package default_store;
use ExtUtils::MakeMaker;
require 5;
use Config;
--- a/perl/manager/Makefile.PL
+++ b/perl/manager/Makefile.PL
@@ -1,3 +1,4 @@
+package manager;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

View File

@@ -0,0 +1,197 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python2_7 )
DISTUTILS_SINGLE_IMPL=yesplz
DISTUTILS_OPTIONAL=yesplz
WANT_AUTOMAKE=none
PATCHSET=3
GENTOO_DEPEND_ON_PERL=no
inherit autotools distutils-r1 eutils perl-module systemd
DESCRIPTION="Software for generating and retrieving SNMP data"
HOMEPAGE="http://net-snmp.sourceforge.net/"
SRC_URI="
mirror://sourceforge/project/${PN}/${PN}/${PV/_p*/}/${P/_p*/}.tar.gz
https://dev.gentoo.org/~jer/${PN}-5.7.3-patches-${PV/*_p/}.tar.xz
https://dev.gentoo.org/~dilfridge/distfiles/${P/_p*/}-perl524.patch.gz
"
S=${WORKDIR}/${P/_/.}
# GPL-2 for the init scripts
LICENSE="HPND BSD GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
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"
COMMON_DEPEND="
ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6d:0 )
libressl? ( dev-libs/libressl )
)
tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
rpm? (
app-arch/rpm
dev-libs/popt
)
bzip2? ( app-arch/bzip2 )
zlib? ( >=sys-libs/zlib-1.1.4 )
elf? ( dev-libs/elfutils )
python? (
dev-python/setuptools[${PYTHON_USEDEP}]
${PYTHON_DEPS}
)
pci? ( sys-apps/pciutils )
lm_sensors? ( sys-apps/lm_sensors )
netlink? ( dev-libs/libnl:3 )
mysql? ( virtual/mysql )
perl? ( dev-lang/perl:= )
"
DEPEND="
${COMMON_DEPEND}
doc? ( app-doc/doxygen )
"
RDEPEND="
${COMMON_DEPEND}
perl? (
X? ( dev-perl/Tk )
!minimal? ( dev-perl/TermReadKey )
)
selinux? ( sec-policy/selinux-snmp )
"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
rpm? ( bzip2 zlib )
"
S=${WORKDIR}/${P/_p*/}
RESTRICT=test
pkg_setup() {
use python && python-single-r1_pkg_setup
}
src_prepare() {
# snmpconf generates config files with proper selinux context
use selinux && eapply "${FILESDIR}"/${PN}-5.1.2-snmpconf-selinux.patch
eapply "${WORKDIR}"/${PN}-5.7.3-perl524.patch
eapply "${FILESDIR}"/${PN}-5.7.3-perl524-2.patch
eapply "${FILESDIR}"/${PN}-5.7.3-mariadb-10.2.patch
eapply "${WORKDIR}"/patches/*.patch
eapply_user
eautoconf
}
src_configure() {
# keep this in the same line, configure.ac arguments are passed down to config.h
local mibs="host ucd-snmp/dlmod ucd-snmp/diskio ucd-snmp/extensible mibII/mta_sendmail etherlike-mib/dot3StatsTable"
use lm_sensors && mibs="${mibs} ucd-snmp/lmsensorsMib"
use smux && mibs="${mibs} smux"
# Assume /etc/mtab is not present with a recent baselayout/openrc (bug #565136)
use kernel_linux && export ac_cv_ETC_MNTTAB=/etc/mtab
econf \
$(use_enable !ssl internal-md5) \
$(use_enable ipv6) \
$(use_enable mfd-rewrites) \
$(use_enable perl embedded-perl) \
$(use_enable ucd-compat ucd-snmp-compatibility) \
$(use_with bzip2) \
$(use_with elf) \
$(use_with mysql) \
$(use_with netlink nl) \
$(use_with pci) \
$(use_with perl perl-modules INSTALLDIRS=vendor) \
$(use_with python python-modules) \
$(use_with rpm) \
$(use_with ssl openssl) \
$(use_with tcpd libwrap) \
$(use_with zlib) \
--enable-shared --disable-static \
--with-default-snmp-version="3" \
--with-install-prefix="${D}" \
--with-ldflags="${LDFLAGS}" \
--with-logfile="/var/log/net-snmpd.log" \
--with-mib-modules="${mibs}" \
--with-persistent-directory="/var/lib/net-snmp" \
--with-sys-contact="root@Unknown" \
--with-sys-location="Unknown"
}
src_compile() {
for target in snmplib agent sedscript all; do
emake OTHERLDFLAGS="${LDFLAGS}" ${target}
done
use doc && emake docsdox
}
src_install () {
# bug #317965
emake -j1 DESTDIR="${D}" install
if use perl ; then
perl_delete_localpod
if ! use X; then
rm "${D}"/usr/bin/tkmib || die
fi
else
rm -f \
"${D}"/usr/bin/fixproc \
"${D}"/usr/bin/ipf-mod.pl \
"${D}"/usr/bin/mib2c \
"${D}"/usr/bin/net-snmp-cert \
"${D}"/usr/bin/snmp-bridge-mib \
"${D}"/usr/bin/snmpcheck \
"${D}"/usr/bin/snmpconf \
"${D}"/usr/bin/tkmib \
"${D}"/usr/bin/traptoemail \
"${D}"/usr/share/snmp/mib2c.perl.conf \
"${D}"/usr/share/snmp/snmp_perl_trapd.pl \
|| die
fi
dodoc AGENT.txt ChangeLog FAQ INSTALL NEWS PORTING README* TODO
newdoc EXAMPLE.conf.def EXAMPLE.conf
if use doc; then
docinto html
dodoc -r docs/html/*
fi
keepdir /var/lib/net-snmp
newinitd "${FILESDIR}"/snmpd.init.2 snmpd
newconfd "${FILESDIR}"/snmpd.conf snmpd
newinitd "${FILESDIR}"/snmptrapd.init.2 snmptrapd
newconfd "${FILESDIR}"/snmptrapd.conf snmptrapd
systemd_dounit "${FILESDIR}"/snmpd.service
systemd_dounit "${FILESDIR}"/snmptrapd.service
insinto /etc/snmp
newins "${S}"/EXAMPLE.conf snmpd.conf.example
# Remove everything not required for an agent.
# Keep only the snmpd, snmptrapd, MIBs, headers and libraries.
if use minimal; then
rm -rf \
"${D}"/**/*.pl \
"${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} \
"${D}"/usr/share/snmp/*.conf \
"${D}"/usr/share/snmp/snmpconf-data \
|| die
fi
prune_libtool_files
}