From 4d62ffcc8ef0b2f7b3781f603c0d34866f7cd039 Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Tue, 22 Sep 2020 12:54:44 +0200 Subject: [PATCH] net-analyzer/net-snmp: New package Package-Manager: Portage-3.0.4, Repoman-3.0.1 Signed-off-by: Alarig Le Lay for PATH_MAX and NAME_MAX + +Author: Anthony G. Basile + +diff -Naur net-snmp-5.7.3.orig/agent/mibgroup/util_funcs/get_pid_from_inode.c net-snmp-5.7.3/agent/mibgroup/util_funcs/get_pid_from_inode.c +--- net-snmp-5.7.3.orig/agent/mibgroup/util_funcs/get_pid_from_inode.c 2014-12-08 15:23:22.000000000 -0500 ++++ net-snmp-5.7.3/agent/mibgroup/util_funcs/get_pid_from_inode.c 2018-02-21 15:34:06.237028136 -0500 +@@ -6,6 +6,7 @@ + + #include + #include ++#include + #if HAVE_STDLIB_H + #include + #endif diff --git a/net-analyzer/net-snmp/files/net-snmp-5.8-do-not-conflate-LDFLAGS-and-LIBS.patch b/net-analyzer/net-snmp/files/net-snmp-5.8-do-not-conflate-LDFLAGS-and-LIBS.patch new file mode 100644 index 0000000..4e3001e --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.8-do-not-conflate-LDFLAGS-and-LIBS.patch @@ -0,0 +1,34 @@ +--- a/net-snmp-config.in ++++ b/net-snmp-config.in +@@ -190,13 +190,13 @@ + #################################################### client lib + --libs) + # use this one == --netsnmp-libs + --external-libs +- echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS ++ echo $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS + ;; + --netsnmp-libs) + echo $NSC_LIBDIR $NSC_BASE_SNMP_LIBS + ;; + --external-libs) +- echo $NSC_LDFLAGS $NSC_LNETSNMPLIBS $NSC_LIBS @PERLLDOPTS_FOR_APPS@ ++ echo $NSC_LNETSNMPLIBS $NSC_LIBS @PERLLDOPTS_FOR_APPS@ + ;; + #################################################### agent lib + --base-agent-libs) +@@ -207,13 +207,13 @@ + ;; + --agent-libs) + # use this one == --netsnmp-agent-libs + --external-libs +- echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS ++ echo $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS + ;; + --netsnmp-agent-libs) + echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS + ;; + --external-agent-libs) +- echo $NSC_LDFLAGS $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS ++ echo $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS + ;; + #################################################### + --version|--ver*) 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 new file mode 100644 index 0000000..4369224 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.8-pcap.patch @@ -0,0 +1,41 @@ +--- a/configure.d/config_project_with_enable ++++ b/configure.d/config_project_with_enable +@@ -1187,6 +1187,11 @@ + [], + [with_bzip2="no"]) + ++AC_ARG_WITH([pcap], ++ [ --with-pcap[=DIR] use libpcap in DIR], ++ [], ++ [with_pcap="no"]) ++ + NETSNMP_ARG_WITH( + [mnttab], + AS_HELP_STRING( +--- a/configure.d/config_os_libs2 ++++ b/configure.d/config_os_libs2 +@@ -583,14 +590,16 @@ + ## + # libpcap + ## +-NETSNMP_BUILD_PCAP_PROG_TRUE='#' +-NETSNMP_BUILD_PCAP_PROG_FALSE='' +-AC_CHECK_LIB([pcap], [pcap_create], [ +- AC_CHECK_HEADERS([pcap/pcap.h], [ +- NETSNMP_BUILD_PCAP_PROG_TRUE='' +- NETSNMP_BUILD_PCAP_PROG_FALSE='#' +- ]) +-]) ++if test "x$with_pcap" = "xyes" ; then ++ NETSNMP_BUILD_PCAP_PROG_TRUE='#' ++ NETSNMP_BUILD_PCAP_PROG_FALSE='' ++ AC_CHECK_LIB([pcap], [pcap_create], [ ++ AC_CHECK_HEADERS([pcap/pcap.h], [ ++ NETSNMP_BUILD_PCAP_PROG_TRUE='' ++ NETSNMP_BUILD_PCAP_PROG_FALSE='#' ++ ]) ++ ]) ++fi + AC_SUBST(NETSNMP_BUILD_PCAP_PROG_TRUE) + AC_SUBST(NETSNMP_BUILD_PCAP_PROG_FALSE) + diff --git a/net-analyzer/net-snmp/files/net-snmp-5.8-tinfo.patch b/net-analyzer/net-snmp/files/net-snmp-5.8-tinfo.patch new file mode 100644 index 0000000..746575a --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.8-tinfo.patch @@ -0,0 +1,10 @@ +--- a/configure.d/config_os_libs2 ++++ b/configure.d/config_os_libs2 +@@ -611,6 +611,7 @@ + AC_CHECK_HEADERS([curses.h]) + AC_CHECK_HEADERS([ncurses/curses.h]) + NETSNMP_SEARCH_LIBS([endwin], [curses ncurses],,,,[LIBCURSES]) ++NETSNMP_SEARCH_LIBS([cbreak], [tinfo],[LIBCURSES="$LIBCURSES -ltinfo"],,,) + AC_SUBST([LIBCURSES]) + + # libm for ceil diff --git a/net-analyzer/net-snmp/files/net-snmp-5.8.1-mysqlclient.patch b/net-analyzer/net-snmp/files/net-snmp-5.8.1-mysqlclient.patch new file mode 100644 index 0000000..9481174 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.8.1-mysqlclient.patch @@ -0,0 +1,30 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -25,6 +25,8 @@ + + AC_MSG_CACHE_INIT() + ++PKG_PROG_PKG_CONFIG ++ + # + # save the configure arguments + # +--- a/configure.d/config_os_libs2 ++++ b/configure.d/config_os_libs2 +@@ -516,6 +516,8 @@ + # mysql + ## + if test "x$with_mysql" = "xyes" ; then ++ PKG_CHECK_MODULES([MYSQL],[mysqlclient],[MYSQL_INCLUDES="$MYSQL_CFLAGS"],) ++ if test -x "$MYSQL_LIBS"; then + AC_PATH_PROGS(MYSQLCONFIG,mysql_config) + test -x "$MYSQLCONFIG" \ + || AC_MSG_ERROR([Could not find mysql_config and was specifically asked to use MySQL support]) +@@ -523,6 +525,7 @@ + MYSQL_INCLUDES=`$MYSQLCONFIG --include` + _libs="${LIBS}" + _cppflags="${CPPFLAGS}" ++ fi + LIBS="${LIBS} ${MYSQL_LIBS}" + CPPFLAGS="${CPPFLAGS} ${MYSQL_INCLUDES}" + AC_CHECK_HEADER(mysql.h,, diff --git a/net-analyzer/net-snmp/files/net-snmp-5.8.1-net-snmp-config-libdir.patch b/net-analyzer/net-snmp/files/net-snmp-5.8.1-net-snmp-config-libdir.patch new file mode 100644 index 0000000..73d4205 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.8.1-net-snmp-config-libdir.patch @@ -0,0 +1,37 @@ +--- a/net-snmp-config.in ++++ b/net-snmp-config.in +@@ -193,10 +193,10 @@ + #################################################### client lib + --libs) + # use this one == --netsnmp-libs + --external-libs +- echo $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS ++ echo $NSC_SNMPLIBS $NSC_LIBS + ;; + --netsnmp-libs) +- echo $NSC_LIBDIR $NSC_BASE_SNMP_LIBS ++ echo $NSC_BASE_SNMP_LIBS + ;; + --external-libs) + echo $NSC_LNETSNMPLIBS $NSC_LIBS @PERLLDOPTS_FOR_APPS@ +@@ -210,10 +210,10 @@ + ;; + --agent-libs) + # use this one == --netsnmp-agent-libs + --external-libs +- echo $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS ++ echo $NSC_AGENTLIBS $NSC_LIBS + ;; + --netsnmp-agent-libs) +- echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS ++ echo $NSC_BASE_AGENT_LIBS + ;; + --external-agent-libs) + echo $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS +@@ -660,7 +660,7 @@ + echo "Ack. Can't create $tmpfile." + exit 1 + fi +- cmd="@CC@ $cflags @CFLAGS@ @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR} -o $outname $tmpfile $cfiles $NSC_LDFLAGS $NSC_LIBDIR $NSC_BASE_AGENT_LIBS $NSC_AGENTLIBS $ldflags" ++ cmd="@CC@ $cflags @CFLAGS@ @DEVFLAGS@ -I. -I${NSC_INCLUDEDIR} -o $outname $tmpfile $cfiles $ldflags $NSC_LDFLAGS $NSC_BASE_AGENT_LIBS $NSC_AGENTLIBS" + echo "running: $cmd" + echo `$cmd` + result=$? diff --git a/net-analyzer/net-snmp/files/net-snmp-5.8.1-pkg-config.patch b/net-analyzer/net-snmp/files/net-snmp-5.8.1-pkg-config.patch new file mode 100644 index 0000000..acda136 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.8.1-pkg-config.patch @@ -0,0 +1,20 @@ +--- a/netsnmp-agent.pc.in ++++ b/netsnmp-agent.pc.in +@@ -8,5 +8,5 @@ + URL: http://www.net-snmp.org + Version: @PACKAGE_VERSION@ + Cflags: -I${includedir} +-Libs: -L${libdir} -lnetsnmpmibs -lnetsnmpagent -lnetsnmp +-Libs.private: @LDFLAGS@ @LMIBLIBS@ @LAGENTLIBS@ @PERLLDOPTS_FOR_APPS@ @LNETSNMPLIBS@ @LIBS@ ++Libs: -lnetsnmpmibs -lnetsnmpagent -lnetsnmp ++Libs.private: @LMIBLIBS@ @LAGENTLIBS@ @PERLLDOPTS_FOR_APPS@ @LNETSNMPLIBS@ @LIBS@ +--- a/netsnmp.pc.in ++++ b/netsnmp.pc.in +@@ -8,5 +8,5 @@ + URL: http://www.net-snmp.org + Version: @PACKAGE_VERSION@ + Cflags: -I${includedir} +-Libs: -L${libdir} -lnetsnmp +-Libs.private: @LDFLAGS@ @LNETSNMPLIBS@ @LIBS@ @PERLLDOPTS_FOR_APPS@ ++Libs: -lnetsnmp ++Libs.private: @LNETSNMPLIBS@ @LIBS@ @PERLLDOPTS_FOR_APPS@ diff --git a/net-analyzer/net-snmp/files/net-snmp-5.9-MakeMaker.patch b/net-analyzer/net-snmp/files/net-snmp-5.9-MakeMaker.patch new file mode 100644 index 0000000..1c6a3fd --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.9-MakeMaker.patch @@ -0,0 +1,10 @@ +--- a/perl/Makefile.PL ++++ b/perl/Makefile.PL +@@ -3,6 +3,7 @@ + use ExtUtils::MakeMaker; + use Config; + require 5; ++use lib '.'; + use MakefileSubs; + + # Prevent that MakeMaker complains about unknown parameter names. diff --git a/net-analyzer/net-snmp/files/net-snmp-99999999-tinfo.patch b/net-analyzer/net-snmp/files/net-snmp-99999999-tinfo.patch new file mode 100644 index 0000000..2eb4ccc --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-99999999-tinfo.patch @@ -0,0 +1,10 @@ +--- a/configure.d/config_os_libs2 ++++ b/configure.d/config_os_libs2 +@@ -601,6 +601,7 @@ + [HAVE_LIBCURSES=FALSE],, + [LIBCURSES]) + AC_SUBST([HAVE_LIBCURSES]) ++NETSNMP_SEARCH_LIBS([cbreak], [tinfo],[LIBCURSES="$LIBCURSES -ltinfo"],,,) + AC_SUBST([LIBCURSES]) + + # libm for ceil diff --git a/net-analyzer/net-snmp/files/snmpd.conf b/net-analyzer/net-snmp/files/snmpd.conf new file mode 100644 index 0000000..9cc6464 --- /dev/null +++ b/net-analyzer/net-snmp/files/snmpd.conf @@ -0,0 +1,19 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Initial (empty) options. +SNMPD_FLAGS="" + +# Disable smux by default +SNMPD_FLAGS="${SNMPD_FLAGS} -I -smux" + +# Enable connection logging. +#SNMPD_FLAGS="${SNMPD_FLAGS} -a" + +# Enable syslog and disable file log. +#SNMPD_FLAGS="${SNMPD_FLAGS} -Lsd -Lf /dev/null" + +# Enable agentx socket as /var/agentx/master +# *NOTE* Before uncommenting this, make sure +# the /var/agentx directory exists. +#SNMPD_FLAGS="${SNMPD_FLAGS} -x /var/agentx/master" diff --git a/net-analyzer/net-snmp/files/snmpd.init.2 b/net-analyzer/net-snmp/files/snmpd.init.2 new file mode 100644 index 0000000..a2830e0 --- /dev/null +++ b/net-analyzer/net-snmp/files/snmpd.init.2 @@ -0,0 +1,34 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +SNMPD_PIDFILE="${SNMPD_PIDFILE:-/var/run/snmpd.pid}" + +extra_started_commands="reload" + +command="/usr/sbin/snmpd" +command_args="-p ${SNMPD_PIDFILE} ${SNMPD_FLAGS}" +pidfile="${SNMPD_PIDFILE}" + +depend() { + use logger +} + +checkconfig() { + if [ ! -e /etc/snmp/snmpd.conf ] ; then + eerror "${SVCNAME} requires an /etc/snmp/snmpd.conf configuration file" + return 1 + fi +} + +start_pre() { + checkconfig || return 1 +} + +reload() { + checkconfig || return 1 + + ebegin "Reloading ${SVCNAME} configuration" + kill -HUP $(cat ${SNMPD_PIDFILE}) 2>&1 > /dev/null + eend $? +} diff --git a/net-analyzer/net-snmp/files/snmpd.service b/net-analyzer/net-snmp/files/snmpd.service new file mode 100644 index 0000000..8150d7b --- /dev/null +++ b/net-analyzer/net-snmp/files/snmpd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Simple Network Management Protocol (SNMP) Daemon +After=syslog.target network.target + +[Service] +ExecStart=/usr/sbin/snmpd -f + +[Install] +WantedBy=multi-user.target diff --git a/net-analyzer/net-snmp/files/snmptrapd.conf b/net-analyzer/net-snmp/files/snmptrapd.conf new file mode 100644 index 0000000..8f91e64 --- /dev/null +++ b/net-analyzer/net-snmp/files/snmptrapd.conf @@ -0,0 +1,15 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# extra flags to pass to snmptrapd +SNMPTRAPD_FLAGS="" + +# ignore authentication failure traps +#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -a" + +# log messages to specified file +#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -Lf /var/log/snmptrapd.log" + +# log messages to syslog with the specified facility +# where facility is: 'd' = LOG_DAEMON, 'u' = LOG_USER, [0-7] = LOG_LOCAL[0-7] +#SNMPTRAPD_FLAGS="${SNMPTRAPD_FLAGS} -Ls d" diff --git a/net-analyzer/net-snmp/files/snmptrapd.init.2 b/net-analyzer/net-snmp/files/snmptrapd.init.2 new file mode 100644 index 0000000..ec954b2 --- /dev/null +++ b/net-analyzer/net-snmp/files/snmptrapd.init.2 @@ -0,0 +1,13 @@ +#!/sbin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +SNMPTRAPD_PIDFILE="${SNMPTRAPD_PIDFILE:-/var/run/snmptrapd.pid}" + +command="/usr/sbin/snmptrapd" +command_args="-p ${SNMPTRAPD_PIDFILE} ${SNMPTRAPD_FLAGS}" +pidfile="${SNMPTRAPD_PIDFILE}" + +depend() { + use logger +} diff --git a/net-analyzer/net-snmp/files/snmptrapd.service b/net-analyzer/net-snmp/files/snmptrapd.service new file mode 100644 index 0000000..7d19444 --- /dev/null +++ b/net-analyzer/net-snmp/files/snmptrapd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Simple Network Management Protocol (SNMP) TRAP Daemon +After=syslog.target network.target + +[Service] +ExecStart=/usr/sbin/snmptrapd -f + +[Install] +WantedBy=multi-user.target diff --git a/net-analyzer/net-snmp/metadata.xml b/net-analyzer/net-snmp/metadata.xml new file mode 100644 index 0000000..f3f6819 --- /dev/null +++ b/net-analyzer/net-snmp/metadata.xml @@ -0,0 +1,22 @@ + + + + +netmon@gentoo.org +Gentoo network monitoring and analysis project + + +Enable the use of elf utils to check uptime on some systems +Enable usage of /dev/kmem +Use MFD rewrites of mib modules where available +Use dev-libs/libnl to fetch TCP statistics instead of using /proc/net/tcp (Linux only). +Install snmppcap which reads from PCAP files and writes to the SNMP transport +Use libpci (from sys-apps/pciutils) to look up network interface description. This feature is only available on Linux. +Enable monitoring of app-arch/rpm. This flag requires the bzip2 and zlib flags to be enabled as well. +Enable support for the legacy smux protocol (superseded by agentx) +Build UCD compatibility library. Increases significantly the install size. + + +net-snmp + + diff --git a/net-analyzer/net-snmp/net-snmp-5.8.1_pre1-r1.ebuild b/net-analyzer/net-snmp/net-snmp-5.8.1_pre1-r1.ebuild new file mode 100644 index 0000000..48c7448 --- /dev/null +++ b/net-analyzer/net-snmp/net-snmp-5.8.1_pre1-r1.ebuild @@ -0,0 +1,211 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +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 perl-module systemd + +DESCRIPTION="Software for generating and retrieving SNMP data" +HOMEPAGE="http://www.net-snmp.org/" +SRC_URI=" + mirror://sourceforge/project/${PN}/${PN}/${PV/_p*/}-pre-releases/${P/_pre/.pre}.tar.gz + https://dev.gentoo.org/~jer/${PN}-5.7.3-patches-3.tar.xz +" + +S=${WORKDIR}/${P/_/.} + +# GPL-2 for the init scripts +LICENSE="HPND BSD GPL-2" +SLOT="0/35" +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 sparc x86" +IUSE=" + X bzip2 doc elf kmem ipv6 libressl lm-sensors mfd-rewrites minimal mysql + netlink pcap pci perl python rpm selinux smux ssl tcpd ucd-compat zlib +" +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) + rpm? ( bzip2 zlib ) +" + +COMMON_DEPEND=" + bzip2? ( app-arch/bzip2 ) + elf? ( dev-libs/elfutils ) + lm-sensors? ( sys-apps/lm-sensors ) + mysql? ( dev-db/mysql-connector-c:0= ) + netlink? ( dev-libs/libnl:3 ) + pcap? ( net-libs/libpcap ) + pci? ( sys-apps/pciutils ) + perl? ( dev-lang/perl:= ) + python? ( + $(python_gen_cond_dep ' + dev-python/setuptools[${PYTHON_MULTI_USEDEP}] + ') + ${PYTHON_DEPS} + ) + rpm? ( + app-arch/rpm + dev-libs/popt + ) + ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6d:0= ) + libressl? ( dev-libs/libressl:= ) + ) + tcpd? ( >=sys-apps/tcp-wrappers-7.6 ) + zlib? ( >=sys-libs/zlib-1.1.4 ) +" +DEPEND=" + ${COMMON_DEPEND} + doc? ( app-doc/doxygen ) +" +RDEPEND=" + ${COMMON_DEPEND} + perl? ( + X? ( dev-perl/Tk ) + !minimal? ( dev-perl/TermReadKey ) + ) + selinux? ( sec-policy/selinux-snmp ) +" +S=${WORKDIR}/${P/_pre/.pre} +RESTRICT=test +PATCHES=( + "${FILESDIR}"/${PN}-5.7.3-include-limits.patch + "${FILESDIR}"/${PN}-5.8-do-not-conflate-LDFLAGS-and-LIBS.patch + "${FILESDIR}"/${PN}-5.8-pcap.patch + "${FILESDIR}"/${PN}-5.8-tinfo.patch + "${FILESDIR}"/${PN}-5.8.1-pkg-config.patch + "${FILESDIR}"/${PN}-5.8.1-net-snmp-config-libdir.patch + "${FILESDIR}"/${PN}-5.8.1-mysqlclient.patch +) + +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 + + mv "${WORKDIR}"/patches/0002-Respect-DESTDIR-for-pythoninstall.patch{,.disabled} || die + mv "${WORKDIR}"/patches/0004-Don-t-report-CFLAGS-and-LDFLAGS-in-net-snmp-config.patch{,.disabled} || die + eapply "${WORKDIR}"/patches/*.patch + + default + + 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 kmem kmem-usage) \ + $(use_with mysql) \ + $(use_with netlink nl) \ + $(use_with pcap) \ + $(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 + + use python && python_optimize + + 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 + + find "${ED}" -name '*.la' -delete || die +} diff --git a/net-analyzer/net-snmp/net-snmp-5.9-r2.ebuild b/net-analyzer/net-snmp/net-snmp-5.9-r2.ebuild new file mode 100644 index 0000000..23a631d --- /dev/null +++ b/net-analyzer/net-snmp/net-snmp-5.9-r2.ebuild @@ -0,0 +1,212 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +DISTUTILS_OPTIONAL=yesplz +DISTUTILS_SINGLE_IMPL=yesplz +GENTOO_DEPEND_ON_PERL=no +PATCHSET=3 +PYTHON_COMPAT=( python3_{6,7,8} ) +WANT_AUTOMAKE=none +inherit autotools distutils-r1 perl-module systemd + +DESCRIPTION="Software for generating and retrieving SNMP data" +HOMEPAGE="http://www.net-snmp.org/" +SRC_URI=" + https://dev.gentoo.org/~jer/${PN}-5.7.3-patches-3.tar.xz + https://dev.gentoo.org/~jer/${P}.tar.xz +" + +# GPL-2 for the init scripts +LICENSE="HPND BSD GPL-2" +SLOT="0/40" +KEYWORDS="~alpha ~amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc x86" +IUSE=" + X bzip2 doc elf kmem ipv6 libressl lm-sensors mfd-rewrites minimal mysql + netlink pcap pci perl python rpm selinux smux ssl tcpd ucd-compat zlib +" +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) + rpm? ( bzip2 zlib ) +" + +COMMON_DEPEND=" + bzip2? ( app-arch/bzip2 ) + elf? ( dev-libs/elfutils ) + lm-sensors? ( sys-apps/lm-sensors ) + mysql? ( dev-db/mysql-connector-c:0= ) + netlink? ( dev-libs/libnl:3 ) + pcap? ( net-libs/libpcap ) + pci? ( sys-apps/pciutils ) + perl? ( dev-lang/perl:= ) + python? ( + $(python_gen_cond_dep ' + dev-python/setuptools[${PYTHON_MULTI_USEDEP}] + ') + ${PYTHON_DEPS} + ) + rpm? ( + app-arch/rpm + dev-libs/popt + ) + ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6d:0= ) + libressl? ( dev-libs/libressl:= ) + ) + tcpd? ( >=sys-apps/tcp-wrappers-7.6 ) + zlib? ( >=sys-libs/zlib-1.1.4 ) +" +DEPEND=" + ${COMMON_DEPEND} + doc? ( app-doc/doxygen ) +" +RDEPEND=" + ${COMMON_DEPEND} + perl? ( + X? ( dev-perl/Tk ) + !minimal? ( dev-perl/TermReadKey ) + ) + selinux? ( sec-policy/selinux-snmp ) +" +RESTRICT=test +PATCHES=( + "${FILESDIR}"/${PN}-5.7.3-include-limits.patch + "${FILESDIR}"/${PN}-5.8-do-not-conflate-LDFLAGS-and-LIBS.patch + "${FILESDIR}"/${PN}-5.8-pcap.patch + "${FILESDIR}"/${PN}-5.8.1-pkg-config.patch + "${FILESDIR}"/${PN}-5.8.1-net-snmp-config-libdir.patch + "${FILESDIR}"/${PN}-5.8.1-mysqlclient.patch + "${FILESDIR}"/${PN}-5.9-MakeMaker.patch + "${FILESDIR}"/${PN}-99999999-tinfo.patch +) + +pkg_setup() { + 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 + + mv "${WORKDIR}"/patches/0002-Respect-DESTDIR-for-pythoninstall.patch{,.disabled} || die + mv "${WORKDIR}"/patches/0004-Don-t-report-CFLAGS-and-LDFLAGS-in-net-snmp-config.patch{,.disabled} || die + eapply "${WORKDIR}"/patches/*.patch + + default + + 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 kmem kmem-usage) \ + $(use_with mysql) \ + $(use_with netlink nl) \ + $(use_with pcap) \ + $(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) \ + --disable-static \ + --enable-shared \ + --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() { + emake sedscript + + local subdir + for subdir in snmplib agent/mibgroup agent apps .; do + emake OTHERLDFLAGS="${LDFLAGS}" -C ${subdir} all + done + + use doc && emake docsdox +} + +src_install() { + # bug #317965 + emake -j1 DESTDIR="${D}" install + + use python && python_optimize + + 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 + + find "${ED}" -name '*.la' -delete || die +} diff --git a/net-analyzer/net-snmp/net-snmp-99999999.ebuild b/net-analyzer/net-snmp/net-snmp-99999999.ebuild new file mode 100644 index 0000000..638e535 --- /dev/null +++ b/net-analyzer/net-snmp/net-snmp-99999999.ebuild @@ -0,0 +1,217 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +DISTUTILS_OPTIONAL=yesplz +DISTUTILS_SINGLE_IMPL=yesplz +GENTOO_DEPEND_ON_PERL=no +PATCHSET=3 +PYTHON_COMPAT=( python3_{6,7,8} ) +WANT_AUTOMAKE=none +inherit autotools distutils-r1 git-r3 perl-module systemd + +DESCRIPTION="Software for generating and retrieving SNMP data" +HOMEPAGE="http://www.net-snmp.org/" +EGIT_REPO_URI="https://github.com/net-snmp/net-snmp" +SRC_URI=" + https://dev.gentoo.org/~jer/${PN}-5.7.3-patches-3.tar.xz +" + +# GPL-2 for the init scripts +LICENSE="HPND BSD GPL-2" +SLOT="0/40" +KEYWORDS="" +IUSE=" + X bzip2 doc elf kmem ipv6 libressl lm-sensors mfd-rewrites minimal mysql + netlink pcap pci perl python rpm selinux smux ssl tcpd ucd-compat zlib +" +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) + rpm? ( bzip2 zlib ) +" + +COMMON_DEPEND=" + bzip2? ( app-arch/bzip2 ) + elf? ( dev-libs/elfutils ) + lm-sensors? ( sys-apps/lm-sensors ) + mysql? ( dev-db/mysql-connector-c:0= ) + netlink? ( dev-libs/libnl:3 ) + pcap? ( net-libs/libpcap ) + pci? ( sys-apps/pciutils ) + perl? ( dev-lang/perl:= ) + python? ( + $(python_gen_cond_dep ' + dev-python/setuptools[${PYTHON_MULTI_USEDEP}] + ') + ${PYTHON_DEPS} + ) + rpm? ( + app-arch/rpm + dev-libs/popt + ) + ssl? ( + !libressl? ( >=dev-libs/openssl-0.9.6d:0= ) + libressl? ( dev-libs/libressl:= ) + ) + tcpd? ( >=sys-apps/tcp-wrappers-7.6 ) + zlib? ( >=sys-libs/zlib-1.1.4 ) +" +DEPEND=" + ${COMMON_DEPEND} + doc? ( app-doc/doxygen ) +" +RDEPEND=" + ${COMMON_DEPEND} + perl? ( + X? ( dev-perl/Tk ) + !minimal? ( dev-perl/TermReadKey ) + ) + selinux? ( sec-policy/selinux-snmp ) +" +RESTRICT=test +PATCHES=( + "${FILESDIR}"/${PN}-5.7.3-include-limits.patch + "${FILESDIR}"/${PN}-5.8-do-not-conflate-LDFLAGS-and-LIBS.patch + "${FILESDIR}"/${PN}-5.8-pcap.patch + "${FILESDIR}"/${PN}-5.8.1-pkg-config.patch + "${FILESDIR}"/${PN}-5.8.1-net-snmp-config-libdir.patch + "${FILESDIR}"/${PN}-5.8.1-mysqlclient.patch + "${FILESDIR}"/${PN}-5.9-MakeMaker.patch + "${FILESDIR}"/${PN}-99999999-tinfo.patch +) + +pkg_setup() { + use python && python-single-r1_pkg_setup +} + +src_unpack() { + default + git-r3_src_unpack +} + +src_prepare() { + # snmpconf generates config files with proper selinux context + use selinux && eapply "${FILESDIR}"/${PN}-5.1.2-snmpconf-selinux.patch + + mv "${WORKDIR}"/patches/0002-Respect-DESTDIR-for-pythoninstall.patch{,.disabled} || die + mv "${WORKDIR}"/patches/0004-Don-t-report-CFLAGS-and-LDFLAGS-in-net-snmp-config.patch{,.disabled} || die + eapply "${WORKDIR}"/patches/*.patch + + default + + 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 kmem kmem-usage) \ + $(use_with mysql) \ + $(use_with netlink nl) \ + $(use_with pcap) \ + $(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) \ + --disable-static \ + --enable-shared \ + --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() { + emake sedscript + + local subdir + for subdir in snmplib agent/mibgroup agent apps .; do + emake OTHERLDFLAGS="${LDFLAGS}" -C ${subdir} all + done + + use doc && emake docsdox +} + +src_install() { + # bug #317965 + emake -j1 DESTDIR="${D}" install + + use python && python_optimize + + 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 + + find "${ED}" -name '*.la' -delete || die +}