# - FHS: #define NETSNMP_AGENTX_SOCKET "/var/agentx/master"
#
# Conditional build:
-%bcond_without autodeps # don't BR packages only for deps resolving
-%bcond_without rpm # don't include RPM support
-%bcond_without kerberos5 # don't include kerberos support
-%bcond_without lm_sensors # don't include sensors support
-%bcond_without perl # don't include Perl modules and utils
-%bcond_without python # don't include Python modules
-%bcond_without static_libs # don't build static library
+%bcond_without rpm # RPM support
+%bcond_without kerberos5 # Kerberos support
+%bcond_without lm_sensors # LM sensors support
+%bcond_without perl # Perl modules and utils
+%bcond_without python # Python (3.x) modules
+%bcond_without python2 # Python 2.x modules
+%bcond_without static_libs # static library
%ifnarch %{ix86} %{x8664} x32
%undefine with_lm_sensors
%endif
-%define so_version 30
-%include /usr/lib/rpm/macros.perl
+%define so_version 40
Summary: A collection of SNMP protocol tools
Summary(es.UTF-8): Agente SNMP de la UCD
Summary(pl.UTF-8): Kolekcja narzędzi do obsługi protokołu SNMP
Summary(ru.UTF-8): Набор утилит для протокола SNMP от UC-Davis
Summary(uk.UTF-8): Набір утиліт для протоколу SNMP від UC-Davis
Name: net-snmp
-# NOTE: 5.7.x is LTS version
-Version: 5.7.3
-Release: 13
+Version: 5.9
+Release: 1
License: BSD-like
Group: Networking/Daemons
Source0: http://downloads.sourceforge.net/net-snmp/%{name}-%{version}.tar.gz
-# Source0-md5: d4a3459e1577d0efa8d96ca70a885e53
+# Source0-md5: 382da80138897f294299badf9c62c699
Source1: %{name}d.init
Source2: %{name}d.conf
Source3: %{name}d.sysconfig
Patch2: %{name}-config-noflags.patch
Patch3: %{name}-manpage.patch
Patch4: %{name}-link.patch
-Patch5: %{name}-llinterfaces.patch
Patch6: %{name}-kernel_headers.patch
Patch7: %{name}-rpmpath.patch
-Patch8: swinst_apt.patch
-Patch9: %{name}-python.patch
-Patch10: %{name}-lvalue.patch
-Patch11: %{name}-defaultconfig.patch
-Patch12: %{name}-use-rpm-hrmib.patch
-Patch13: %{name}-TCP_STATS_CACHE_TIMEOUT.patch
-Patch14: %{name}-logging.patch
-Patch15: %{name}-Remove-U64-typedef.patch
-Patch16: %{name}-Fix-Makefile-PL.patch
+Patch8: %{name}-python.patch
+Patch9: %{name}-lvalue.patch
+Patch10: %{name}-defaultconfig.patch
+Patch11: %{name}-use-rpm-hrmib.patch
+Patch12: %{name}-TCP_STATS_CACHE_TIMEOUT.patch
+Patch13: %{name}-logging.patch
+Patch14: %{name}-Remove-U64-typedef.patch
+Patch15: 1314610.patch
URL: http://www.net-snmp.org/
BuildRequires: autoconf >= 2.63
BuildRequires: automake
BuildRequires: elfutils-devel
%{?with_kerberos5:BuildRequires: heimdal-devel}
BuildRequires: libnl-devel >= 1:3.2
+BuildRequires: libpcap-devel
BuildRequires: libssh2-devel
BuildRequires: libtool >= 1.4
BuildRequires: libwrap-devel
%{?with_lm_sensors:BuildRequires: lm_sensors-devel >= 3.0.1}
+BuildRequires: ncurses-devel
BuildRequires: openssl-devel >= 0.9.7d
BuildRequires: pciutils-devel
-%{?with_autodeps:BuildRequires: perl-Term-ReadKey}
+BuildRequires: pcre-devel
BuildRequires: perl-devel >= 1:5.8.0
+BuildRequires: pkgconfig >= 1:0.9.0
%if %{with python}
-BuildRequires: python-devel
-BuildRequires: python-modules
+%if %{with python2}
+BuildRequires: python-devel >= 1:2.5
+BuildRequires: python-modules >= 1:2.5
BuildRequires: python-setuptools
+%endif
+BuildRequires: python3-devel >= 1:3.2
+BuildRequires: python3-modules >= 1:3.2
+BuildRequires: python3-setuptools
BuildRequires: rpm-pythonprov
%endif
%if %{with rpm}
Przeglądarka MIB-ów w Tk.
%package -n python-netsnmp
-Summary: Python netsnmp extension module
-Summary(pl.UTF-8): Moduł rozszerzenia netsnmp dla Pythona
+Summary: Python 2 netsnmp extension module
+Summary(pl.UTF-8): Moduł rozszerzenia netsnmp dla Pythona 2
Group: Libraries/Python
Requires: %{name}-libs = %{version}-%{release}
Moduł rozszerzenia netsnmp dla Pythona udostępnia pełne API klienckie
SNMP dla trzech wersji tego protokołu (SNMPv3, SNMPv2c, SNMPv1).
+%package -n python3-netsnmp
+Summary: Python 3 netsnmp extension module
+Summary(pl.UTF-8): Moduł rozszerzenia netsnmp dla Pythona 3
+Group: Libraries/Python
+Requires: %{name}-libs = %{version}-%{release}
+
+%description -n python3-netsnmp
+The 'netsnmp' Python extension module provides a full featured,
+tri-lingual SNMP (SNMPv3, SNMPv2c, SNMPv1) client API.
+
+%description -n python3-netsnmp -l pl.UTF-8
+Moduł rozszerzenia netsnmp dla Pythona udostępnia pełne API klienckie
+SNMP dla trzech wersji tego protokołu (SNMPv3, SNMPv2c, SNMPv1).
+
%prep
%setup -q -a7
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
-%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
-%patch16 -p1
+
+%{__sed} -E -i -e '1s,#!\s*/usr/bin/env\s+perl(\s|$),#!%{__perl}\1,' \
+ perl/SNMP/examples/pingmib.pl
%build
%{__libtoolize}
%{__aclocal} -I m4
%{__autoconf}
%{__autoheader}
-cp -f /usr/share/automake/config.sub .
MIBS="\
host agentx smux \
%{__make} -j1
+TOPDIR="$(pwd)"
+
cd perl
-%{__perl} Makefile.PL \
+%{__perl} -I. Makefile.PL \
+ -NET-SNMP-CONFIG="${TOPDIR}/net-snmp-config" \
-NET-SNMP-IN-SOURCE=true \
INSTALLDIRS=vendor \
OPTIMIZE="%{rpmcflags} %{rpmcppflags}" \
</dev/null
# avoid rpaths generated by MakeMaker
-perl -pi -e 's@LD_RUN_PATH="\$\(LD_RUN_PATH\)" @@' */Makefile */*/Makefile
+%{__perl} -pi -e 's@LD_RUN_PATH="\$\(LD_RUN_PATH\)" @@' */Makefile */*/Makefile
-bd=$(cd ..; pwd)
%{__make} \
- LDFLAGS="%{rpmldflags} -L$bd/snmplib/.libs/ -L$bd/agent/.libs/"
+ LDFLAGS="%{rpmldflags} -L${TOPDIR}/snmplib/.libs/ -L${TOPDIR}/agent/.libs/"
+cd ..
+
+%if %{with python2}
+cd python
+%py_build \
+ --basedir=$TOPDIR
+cd ..
+%endif
%install
rm -rf $RPM_BUILD_ROOT
# IP-Filter (non-Linux)
%{__rm} $RPM_BUILD_ROOT%{_bindir}/ipf-mod.pl
-%{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/Bundle/Makefile.subs.pl
+%{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/Bundle/MakefileSubs.pm
rm -f $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod
rm -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/Bundle/NetSNMP/.packlist
%endif
%if %{with python}
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/netsnmp/tests
+%endif
+
+%if %{with python2}
+cd python
+%py_install \
+ --basedir=$TOPDIR
+cd ..
+
%{__rm} -r $RPM_BUILD_ROOT%{py_sitedir}/netsnmp/tests
%{__rm} $RPM_BUILD_ROOT%{py_sitedir}/netsnmp/*.py
%endif
%{_libdir}/libnetsnmpmibs.la
%{_libdir}/libnetsnmptrapd.la
%{_includedir}/net-snmp
+%{_pkgconfigdir}/netsnmp.pc
+%{_pkgconfigdir}/netsnmp-agent.pc
%{_datadir}/snmp/mib2c*
%{_mandir}/man1/mib2c.1*
%{_mandir}/man1/mib2c-update.1*
%attr(755,root,root) %{_bindir}/snmpgetnext
%attr(755,root,root) %{_bindir}/snmpinform
%attr(755,root,root) %{_bindir}/snmpnetstat
+%attr(755,root,root) %{_bindir}/snmppcap
+%attr(755,root,root) %{_bindir}/snmpping
+%attr(755,root,root) %{_bindir}/snmpps
%attr(755,root,root) %{_bindir}/snmpset
%attr(755,root,root) %{_bindir}/snmpstatus
%attr(755,root,root) %{_bindir}/snmptable
%attr(755,root,root) %{_bindir}/snmptest
%attr(755,root,root) %{_bindir}/snmptls
+%attr(755,root,root) %{_bindir}/snmptop
%attr(755,root,root) %{_bindir}/snmptranslate
%attr(755,root,root) %{_bindir}/snmptrap
%attr(755,root,root) %{_bindir}/snmpusm
%{_mandir}/man1/snmpgetnext.1*
%{_mandir}/man1/snmpinform.1*
%{_mandir}/man1/snmpnetstat.1*
+%{_mandir}/man1/snmpps.1*
%{_mandir}/man1/snmpset.1*
%{_mandir}/man1/snmpstatus.1*
%{_mandir}/man1/snmptable.1*
%{_mandir}/man1/snmptest.1*
+%{_mandir}/man1/snmptop.1*
%{_mandir}/man1/snmptranslate.1*
%{_mandir}/man1/snmptrap.1*
%{_mandir}/man1/snmpusm.1*
%files utils-perl
%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/checkbandwidth
%attr(755,root,root) %{_bindir}/fixproc
%attr(755,root,root) %{_bindir}/net-snmp-cert
%attr(755,root,root) %{_bindir}/snmp-bridge-mib
%{_mandir}/man1/tkmib.1*
%endif
-%if %{with python}
+%if %{with python2}
%files -n python-netsnmp
%defattr(644,root,root,755)
%dir %{py_sitedir}/netsnmp
-%attr(755,root,root) %{py_sitedir}/netsnmp/*.so
+%attr(755,root,root) %{py_sitedir}/netsnmp/client_intf.so
%{py_sitedir}/netsnmp/*.py[co]
%{py_sitedir}/netsnmp_python-*.egg-info
%endif
+
+%if %{with python}
+%files -n python3-netsnmp
+%defattr(644,root,root,755)
+%dir %{py3_sitedir}/netsnmp
+%attr(755,root,root) %{py3_sitedir}/netsnmp/client_intf.cpython-*.so
+%{py3_sitedir}/netsnmp/*.py
+%{py3_sitedir}/netsnmp/__pycache__
+%{py3_sitedir}/netsnmp_python-*.egg-info
+%endif