-# TODO: python-netsnmp links with libnetsnmp.so.* installed on builder
+# TODO
+# - package or remove:
+# %{py_sitedir}/netsnmp/__init__.py
+# %{py_sitedir}/netsnmp/client.py
+# %{py_sitedir}/netsnmp/tests/__init__.py
+# %{py_sitedir}/netsnmp/tests/__init__.pyc
+# %{py_sitedir}/netsnmp/tests/__init__.pyo
+# %{py_sitedir}/netsnmp/tests/test.py
+# %{py_sitedir}/netsnmp/tests/test.pyc
+# %{py_sitedir}/netsnmp/tests/test.pyo
+# %{_datadir}/snmp/snmp_perl.pl
#
# 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
#
%include /usr/lib/rpm/macros.perl
Summary: A collection of SNMP protocol tools
Summary(ru.UTF-8): Набор утилит для протокола SNMP от UC-Davis
Summary(uk.UTF-8): Набір утиліт для протоколу SNMP від UC-Davis
Name: net-snmp
-Version: 5.4
-Release: 3
+Version: 5.4.1
+Release: 5
License: BSD-like
Group: Networking/Daemons
Source0: http://dl.sourceforge.net/net-snmp/%{name}-%{version}.tar.gz
-# Source0-md5: 46d893281056ff476e597659cb91574d
+# Source0-md5: 6c974df7a5a5b1579f72115e6b045bda
Source1: %{name}d.init
Source2: %{name}d.conf
Source3: %{name}d.sysconfig
Patch0: %{name}-acfix.patch
Patch1: %{name}-rpm-implicit-libs.patch
Patch2: %{name}-config-noflags.patch
-Patch3: %{name}-dlopen-fix.patch
-Patch4: %{name}-manpage.patch
-Patch5: %{name}-link.patch
-Patch6: %{name}-llinterfaces.patch
-Patch7: %{name}-kernel_headers.patch
-Patch8: %{name}-rpmpath.patch
-Patch9: %{name}-snmpksm.patch
-Patch10: %{name}-python.patch
-Patch11: %{name}-python-includes.patch
+Patch3: %{name}-manpage.patch
+Patch4: %{name}-link.patch
+Patch5: %{name}-llinterfaces.patch
+Patch6: %{name}-kernel_headers.patch
+Patch7: %{name}-rpmpath.patch
+Patch8: %{name}-snmpksm.patch
+Patch9: %{name}-python.patch
+Patch10: %{name}-lvalue.patch
URL: http://www.net-snmp.org/
-BuildRequires: autoconf >= 2.57-3
+BuildRequires: autoconf >= 2.61-3
BuildRequires: automake
BuildRequires: elfutils-devel
-BuildRequires: heimdal-devel
+%{?with_kerberos5:BuildRequires: krb5-devel}
BuildRequires: libtool >= 1.4
BuildRequires: libwrap-devel
-BuildRequires: lm_sensors-devel
+%{?with_lm_sensors:BuildRequires: lm_sensors-devel}
BuildRequires: openssl-devel >= 0.9.7d
%{?with_autodeps:BuildRequires: perl-Term-ReadKey}
BuildRequires: perl-devel >= 1:5.8.0
+%if %{with python}
BuildRequires: python-devel >= 1:2.5
BuildRequires: python-setuptools
+%endif
+%if %{with rpm}
BuildRequires: rpm-devel >= 4.0
BuildRequires: rpm-perlprov >= 3.0.3-16
+%endif
BuildRequires: rpmbuild(macros) >= 1.176
BuildRequires: rpmbuild(macros) >= 1.268
Requires(post,preun): /sbin/chkconfig
Requires: %{name}-libs = %{version}-%{release}
+Requires: %{name}-mibs = %{version}-%{release}
Requires: /usr/bin/setsid
Requires: rc-scripts >= 0.2.0
Provides: snmpd
Summary: NET SNMP libraries
Summary(pl.UTF-8): Biblioteki SNMP
Group: Libraries
-Requires: %{name}-mibs = %{version}-%{release}
+Requires: %{name}-mibs
Obsoletes: net-snmp-compat-libs
Obsoletes: ucd-snmp-libs
Group: Development/Libraries
Requires: %{name}-libs = %{version}-%{release}
Requires: elfutils-devel
+%{?with_kerberos5:Requires: krb5-devel}
Requires: libwrap-devel
-Requires: lm_sensors-devel
+%{?with_lm_sensors:Requires: lm_sensors-devel}
Requires: openssl-devel >= 0.9.7c
-Requires: rpm-devel
+%{?with_rpm:Requires: rpm-devel}
Obsoletes: ucd-snmp-devel
%description devel
Summary(uk.UTF-8): Утиліти керування мережею по SNMP з проекту NET-SNMP
Group: Applications/System
Requires: %{name}-libs = %{version}-%{release}
+Requires: %{name}-mibs = %{version}-%{release}
Obsoletes: cmu-snmp-utils
Obsoletes: ucd-snmp-utils
%patch8 -p1
%patch9 -p1
%patch10 -p1
-%patch11 -p1
%build
%{__libtoolize}
%{__autoconf}
%{__autoheader}
%configure \
+ --disable-debugging \
+ --enable-as-needed \
--with-cflags="%{rpmcflags} -I/usr/include/et" \
--with-ldflags="%{rpmldflags}" \
--with-defaults \
--with-default-snmp-version=3 \
- --with-krb5 \
- --with-libwrap \
+ %{?with_kerberos5:--with-krb5=%{_prefix}} \
+ %{!?with_kerberos5:--without-krb5} \
+ --with-openssl=%{_prefix} \
+ --with-libwrap=%{_prefix} \
--with-logfile="%{logfile}" \
- --with-mib-modules="host disman/event-mib smux mibII/mta_sendmail \
+ --with-zlib=%{_prefix} \
+ --with-bzip2=%{_prefix} \
+ --with%{!?with_rpm:out}-perl-modules \
+ --with%{!?with_rpm:out}-python-modules \
+ --with-mib-modules="host agentx smux mibII/mta_sendmail \
%ifarch %{ix86} %{x8664}
- ucd-snmp/lmSensors ucd-snmp/diskio \
+%if %{with lm_sensors}
+ ucd-snmp/lmSensors \
%endif
- agentx target misc/ipfwacc" \
- --with-openssl \
- --with-perl-modules \
- --with-persistent-directory="/var/lib/net-snmp" \
- --with-python-modules \
- --with-security-modules="ksm" \
+%endif
+ disman/event disman/schedule ucd-snmp/diskio \
+ target misc/ipfwacc" \
+ %{?with_kerberos5:--with-security-modules="ksm"} \
--with-sys-contact="root@localhost" \
--with-sys-location="Unknown" \
--with-transports="UDP UDPIPv6 TCP TCPIPv6 Unix Callback " \
- --disable-debugging \
- --enable-as-needed \
+ --with-persistent-directory="/var/lib/net-snmp" \
+ --enable-ucd-snmp-compatibility \
--enable-ipv6 \
- --enable-ucd-snmp-compatibility
-
-# --enable-reentrant is broken - snmpd deadlocks on send (tries to lock the same mutex twice):
-# #4 0xb760f54e in siglongjmp () from /lib/tls/libpthread.so.0
-# #5 0xb7e5e0cf in snmp_res_lock (groupID=0, resourceID=1) at mt_support.c:103
-# #6 0xb7e45698 in snmp_sess_pointer (session=0x80ff868) at snmp_api.c:6975
-# #7 0xb7e41aca in snmp_async_send (session=0x80ff868, pdu=0x8141848, callback=0, cb_data=0x0)
-# at snmp_api.c:4564
-# #8 0xb7e41a6d in snmp_send (session=0x80ff868, pdu=0x8141848) at snmp_api.c:4551
-# #9 0xb7ebf6fd in netsnmp_wrap_up_request (asp=0x812d828, status=0) at snmp_agent.c:1627
-# #10 0xb7ec12e3 in netsnmp_handle_request (asp=0x812d828, status=0) at snmp_agent.c:2996
-# #11 0xb7ebfa65 in handle_snmp_packet (op=1, session=0x80ff868, reqid=628270607, pdu=0x81419b8,
-# magic=0x0) at snmp_agent.c:1792
-# #12 0xb7e42b1c in _sess_process_packet (sessp=0x812c970, sp=0x80ff868, isp=0x812c698,
-# transport=0x8142028, opaque=0x812c1a0, olength=16,
-# packetptr=0x8145cb8 "0f\002\001\0030\021\002\004c [Ç\002\003", length=104) at snmp_api.c:5208
-# #13 0xb7e434e6 in _sess_read (sessp=0x812c970, fdset=0xbfffe0e0) at snmp_api.c:5606
-# #14 0xb7e43535 in snmp_sess_read (sessp=0x812c970, fdset=0xbfffe0e0) at snmp_api.c:5625
-# #15 0xb7e42c44 in snmp_read (fdset=0xbfffe0e0) at snmp_api.c:5260
-# #16 0x0804bbe5 in receive () at snmpd.c:1149
-# #17 0x0804b53d in main (argc=5, argv=0xbffff344) at snmpd.c:993
-# [res mutex with groupID=0, resourceID=1 already locked in snmp_read() at snmp_api.c:5258]
-
-# build this subdir first. it's causing STRANGE compile failures # otherwise (for me at least). glen
-%{__make} -C agent/mibgroup
-%{__make}
+ --with%{!?with_rpm:out}-rpm
+
+%{__make} -j1
cd perl
# IP-Filter (non-Linux)
rm -f $RPM_BUILD_ROOT%{_bindir}/ipf-mod.pl
+rm -f $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod
+rm -f $RPM_BUILD_ROOT%{perl_vendorarch}/Bundle/Makefile.subs.pl
+rm -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/Bundle/NetSNMP/.packlist
+
%clean
rm -rf $RPM_BUILD_ROOT
%attr(754,root,root) /etc/rc.d/init.d/snmptrapd
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/snmptrapd
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/snmp/snmptrapd.conf
+%if %{with perl}
%attr(755,root,root) %{_datadir}/snmp/snmp_perl_trapd.pl
+%endif
%{_mandir}/man5/snmptrapd.conf.5*
%{_mandir}/man8/snmptrapd.8*
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/snmp/snmp.conf
+%if %{with perl}
%files -n perl-SNMP
%defattr(644,root,root,755)
%doc perl/SNMP/{BUG,README,TODO} perl/SNMP/examples
%attr(755,root,root) %{_bindir}/traptoemail
%{_mandir}/man1/fixproc.1*
%{_mandir}/man1/traptoemail.1*
+%endif
%files snmpconf
%defattr(644,root,root,755)
%{_mandir}/man1/snmpconf.1*
%{_datadir}/snmp/snmpconf-data
+%if %{with perl}
%files tkmib
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/tkmib
%{_mandir}/man1/tkmib.1*
+%endif
+%if %{with python}
%files -n python-netsnmp
%defattr(644,root,root,755)
%dir %{py_sitedir}/netsnmp
%attr(755,root,root) %{py_sitedir}/netsnmp/*.so
%{py_sitedir}/netsnmp/*.py[co]
%{py_sitedir}/netsnmp_python-*.egg-info
+%endif