SHA256
1
0
forked from pool/net-snmp
net-snmp/net-snmp.spec

422 lines
13 KiB
RPMSpec

#
# spec file for package net-snmp
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# compatibility for SLES11 <=SP1
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%define pkg_name net-snmp
%ifnarch s390 s390x
%define netsnmp_with_sensors 1
%endif
%define netsnmp_check 1
%define netsnmp_logfile /var/log/net-snmpd.log
%define netsnmp_agentx_socket_dir_fhs /var/run/agentx
%define netsnmp_agentx_socket_dir_rfc /var/agentx
Name: net-snmp
Version: 5.7.2
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: openssl-devel
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: rpm-devel
BuildRequires: tcpd-devel
%if 0%{?netsnmp_with_sensors}
BuildRequires: libsensors4-devel
%endif
Requires: logrotate
Requires: perl-SNMP = %{version}
Requires: perl-TermReadKey
PreReq: %insserv_prereq %fillup_prereq /sbin/chkconfig
# bug437293
%ifarch ppc64
Obsoletes: net-snmp-64bit
%endif
#
Url: http://sourceforge.net/projects/net-snmp
Source: http://sourceforge.net/projects/net-snmp/files/net-snmp/%{version}/%{pkg_name}-%{version}.tar.gz
Source1: rc.snmpd
Source2: snmpd.conf
Source3: README.SUSE
Source4: rc.snmptrapd
Source5: net-snmp.logrotate
Source6: test_installed
Source7: net-snmp.sysconfig
Source8: net-snmp-rpmlintrc
Source9: baselibs.conf
Patch1: net-snmp-5.7.2-socket-path.patch
Patch2: net-snmp-5.7.2-testing-empty-arptable.patch
Patch3: net-snmp-5.7.2-pie.patch
Patch5: net-snmp-5.7.2-net-snmp-config-headercheck.patch
Patch6: net-snmp-5.7.2-perl-tk-warning.patch
Patch7: net-snmp-5.7.2-velocity-mib.patch
Patch8: net-snmp-5.7.2-build-fix-for-strlcat.patch
Patch23: net-snmp-5.7.2-fix-snmpd-crashing-when-an-agentx-disconnects.patch
#
Summary: SNMP Daemon
License: BSD-3-Clause and MIT
Group: Productivity/Networking/Other
%description
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
- An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
- Command-line applications to retrieve and manipulate information from
SNMP-capable devices
- A daemon application for receiving SNMP notifications
- A library for developing new SNMP applications, with C and Perl APIs
- A graphical MIB browser.
This package was originally based on the CMU 2.1.2.1 snmp code. It was
renamed from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp
to net-snmp in November 2000.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%define library_name libsnmp30
%package -n libsnmp30
Requires: perl-base = %{perl_version}
Requires: snmp-mibs = %{version}
#
Summary: Shared Libraries from net-snmp
License: BSD-3-Clause and MIT
Group: Productivity/Networking/Other
%description -n libsnmp30
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
* An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
* Command-line applications to retrieve and manipulate information from
SNMP-capable devices
* A daemon application for receiving SNMP notifications
* A library for developing new SNMP applications, with C and Perl APIs
* A graphical MIB browser.
This package holds the shared libraries from the net-snmp package.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package devel
# bug437293
%ifarch ppc64
Obsoletes: net-snmp-devel-64bit
%endif
#
Requires: %{library_name} = %{version}
# for mib2c
Requires: libopenssl-devel
Requires: perl
Requires: perl-SNMP = %{version}
Requires: rpm-devel
Requires: tcpd-devel
Requires: zlib-devel
%if 0%{?netsnmp_with_sensors}
Requires: libsensors4-devel
%endif
#
Summary: Development files from net-snmp
License: BSD-3-Clause and MIT
Group: Development/Libraries/C and C++
%description devel
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
* An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
* Command-line applications to retrieve and manipulate information from
SNMP-capable devices
* A daemon application for receiving SNMP notifications
* A library for developing new SNMP applications, with C and Perl APIs
* A graphical MIB browser.
This package holds the development headers, libraries and API documentation
from the net-snmp package.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package -n snmp-mibs
#
Summary: MIB files from net-snmp
License: BSD-3-Clause and MIT
Group: Productivity/Networking/Other
%description -n snmp-mibs
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
- An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
- Command-line applications to retrieve and manipulate information from
SNMP-capable devices
- A daemon application for receiving SNMP notifications
- A library for developing new SNMP applications, with C and Perl APIs
- A graphical MIB browser.
This package holds the MIB files from the net-snmp package.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package -n perl-SNMP
Requires: %{pkg_name} = %{version}
Requires: perl-base = %{perl_version}
#
Summary: Perl5 SNMP Extension Module
License: GPL-2.0+
Group: Development/Libraries/Perl
%description -n perl-SNMP
The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 library.
Authors:
--------
G.S. Marzot <gmarzot@nortelnetworks.com>
%package python
Summary: The Python 'netsnmp' module for the Net-SNMP
License: BSD-3-Clause and MIT
Group: Development/Libraries/Python
%description python
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
Net-SNMP toolkit library.
Authors:
--------
G.S. Marzot <gmarzot@nortelnetworks.com>
%prep
%setup -q -n %{pkg_name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch23 -p1
%build
MIBS="misc/ipfwacc ucd-snmp/diskio etherlike-mib rmon-mib velocity smux \
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
ip-mib/ipDefaultRouterTable ip-mib/ipAddressPrefixTable \
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable"
%if 0%{?netsnmp_with_sensors}
MIBS="$MIBS ucd-snmp/lmsensorsMib"
%endif
%configure \
--with-sys-contact="root@localhost" \
--with-sys-location="unknown" \
--with-mib-modules="$MIBS" \
--with-cflags="%{optflags} -fstack-protector-all" \
--with-persistent-directory="/var/lib/net-snmp" \
--with-agentx-socket="%{netsnmp_agentx_socket_dir_fhs}/master" \
--with-logfile="%{netsnmp_logfile}" \
--with-libwrap="%{_prefix}" \
--with-perl-modules="INSTALLDIRS=vendor" \
--with-defaults \
--enable-shared \
--disable-static \
--enable-as-needed \
--without-root-access \
--enable-local-smux \
--enable-ipv6 \
--enable-ucd-snmp-compatibility
# Parallel building is disabled because dependencies between the Perl
# module and libnetsnmp are not correctly defined.
make #%{?_smp_mflags}
pushd python
%{__python} setup.py --basedir="../" build
popd
%check
%if 0%{?netsnmp_check}
%ifnarch %arm
ulimit -c unlimited
%{__make} test ||:
%{__make} test TESTOPTS='-P tcp' ||:
%endif
%{__make} perlmodules ||:
LD_RUN_PATH="$PWD/snmplib/.libs" LD_LIBRARY_PATH="${PWD}/snmplib/.libs:${PWD}/agent/.libs:${PWD}/agent/helpers/.libs" %{__make} perltest ||:
%endif
%install
%makeinstall INSTALL_PREFIX=%{buildroot}
%{__install} -Dd %{buildroot}/var/log %{buildroot}/var/lib/net-snmp %{buildroot}/usr/lib/net-snmp/agents %{buildroot}%{netsnmp_agentx_socket_dir_fhs}
%{__install} -D -m 0755 %{SOURCE1} %{buildroot}/etc/init.d/snmpd
%{__install} -D -m 0755 %{SOURCE4} %{buildroot}/etc/init.d/snmptrapd
%{__install} -D -m 0600 %{SOURCE2} %{buildroot}/etc/snmp/snmpd.conf
%{__install} -m 0644 %{SOURCE3} .
%{__install} -m 0644 %{SOURCE4} .
%{__install} -D -m 0644 %{SOURCE5} %{buildroot}/etc/logrotate.d/net-snmp
%{__install} -m 0744 %{SOURCE6} testing/
%{__ln_s} -f /etc/init.d/snmpd %{buildroot}%{_sbindir}/rcsnmpd
%{__ln_s} -f /etc/init.d/snmptrapd %{buildroot}%{_sbindir}/rcsnmptrapd
%{__install} -m 0644 /dev/null %{buildroot}%{netsnmp_logfile}
pushd perl
%perl_make_install
%perl_process_packlist
%{__rm} -f %{buildroot}/%{perl_vendorarch}/Bundle/Makefile.subs.pl
popd
pushd python
%{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot}
popd
%{__grep} -v "^#define PACKAGE" %{buildroot}%{_includedir}/net-snmp/net-snmp-config.h > \
%{buildroot}%{_includedir}/net-snmp/net-snmp-config.h.new
%{__mv} %{buildroot}%{_includedir}/net-snmp/net-snmp-config.h{.new,}
%{__install} -D -m 0644 %{S:7} \
%{buildroot}/var/adm/fillup-templates/sysconfig.%{pkg_name}
#
%{__ln_s} -f %{netsnmp_agentx_socket_dir_fhs} %{buildroot}%{netsnmp_agentx_socket_dir_rfc}
#
rm -f "%buildroot/%_libdir"/*.la
%preun
%stop_on_removal snmpd
%post
/sbin/chkconfig -c snmpd 2> /dev/null && FIRST_ARG=2
%{fillup_only}
%postun
%restart_on_update snmpd
%restart_on_update snmptrapd
%{insserv_cleanup}
%post -n %{library_name} -p /sbin/ldconfig
%postun -n %{library_name} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc AGENT.txt COPYING EXAMPLE.conf EXAMPLE.conf.def
%doc FAQ NEWS TODO CHANGES
%doc README README.agent-mibs README.agentx README.krb5 README.snmpv3 README.thread
%dir /etc/snmp
%config(noreplace) /etc/snmp/snmpd.conf
%config /etc/init.d/snmpd
%config /etc/init.d/snmptrapd
%{_bindir}/encode_keychange
%{_bindir}/fixproc
%{_bindir}/ipf-mod.pl
%{_bindir}/net-snmp-config
%{_bindir}/snmpbulkget
%{_bindir}/snmpbulkwalk
%{_bindir}/snmpcheck
%{_bindir}/snmpconf
%{_bindir}/snmpdelta
%{_bindir}/snmpdf
%{_bindir}/snmpget
%{_bindir}/snmpgetnext
%{_bindir}/snmpinform
%{_bindir}/snmpnetstat
%{_bindir}/snmpset
%{_bindir}/snmpstatus
%{_bindir}/snmptable
%{_bindir}/snmptest
%{_bindir}/snmptranslate
%{_bindir}/snmptrap
%{_bindir}/snmpusm
%{_bindir}/snmpvacm
%{_bindir}/snmpwalk
%{_bindir}/traptoemail
%{_bindir}/net-snmp-create-v3-user
%{_bindir}/net-snmp-cert
%{_bindir}/agentxtrap
%{_bindir}/snmp-bridge-mib
%dir %{_prefix}/lib/net-snmp
%dir %{_prefix}/lib/net-snmp/agents
%{_mandir}/man[158]/*
%{_sbindir}/*
/var/lib/net-snmp
%dir %ghost %attr(700,root,root) %{netsnmp_agentx_socket_dir_fhs}
%ghost %{netsnmp_logfile}
%config(noreplace) /etc/logrotate.d/net-snmp
/var/adm/fillup-templates/sysconfig.%{pkg_name}
%{netsnmp_agentx_socket_dir_rfc}
%{_datadir}/snmp/snmpconf-data/
%{_datadir}/snmp/snmp_perl.pl
%{_datadir}/snmp/snmp_perl_trapd.pl
%files -n snmp-mibs
%defattr(-,root,root)
%dir %{_datadir}/snmp
%{_datadir}/snmp/mibs/
%files -n %{library_name}
%defattr(-,root,root)
%{_libdir}/libsnmp*.so.*
%{_libdir}/libnetsnmp*.so.*
%files devel
%defattr(-,root,root)
%doc ChangeLog PORTING
%{_mandir}/man3/*
%{_includedir}/ucd-snmp
%{_includedir}/net-snmp
%{_libdir}/libsnmp*.so
%{_libdir}/libnetsnmp*.so
%{_bindir}/mib2c
%{_bindir}/mib2c-update
%{_datadir}/snmp/mib2c*
%files -n perl-SNMP
%defattr(-,root,root)
%{perl_vendorarch}/auto/SNMP
%{perl_vendorarch}/auto/NetSNMP
%{perl_vendorarch}/auto/Bundle
%{perl_vendorarch}/SNMP.pm
%{perl_vendorarch}/NetSNMP
%{_bindir}/tkmib
%if 0%{?suse_version} <= 1130
/var/adm/perl-modules/net-snmp
%endif
%files python
%defattr(-,root,root)
%doc README
%{python_sitearch}/*
%changelog