net-snmp/net-snmp.spec

436 lines
12 KiB
RPMSpec
Raw Normal View History

#
# spec file for package net-snmp (Version 5.4.2.1)
#
# Copyright (c) 2009 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/
#
# norootforbuild
Name: net-snmp
Version: 5.4.2.1
Release: 10
#
License: BSD 3-clause (or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
#
%define pkg_name net-snmp
%ifnarch s390 s390x
%define with_sensors 1
%endif
%if 0%{?suse_version} > 1020
%define perl_requires Requires: perl-base = %{perl_version}
%else
%define perl_requires Requires: perl = %{perl_version}
%endif
%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
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: openssl-devel rpm-devel tcpd-devel
%if 0%{?with_sensors}
BuildRequires: libsensors3-devel
%endif
Requires: perl-TermReadKey logrotate
Requires: perl-SNMP = %{version}
PreReq: %insserv_prereq %fillup_prereq /sbin/chkconfig
Provides: snmp ucdsnmp
Obsoletes: snmp ucdsnmp
# bug437293
%ifarch ppc64
Obsoletes: net-snmp-64bit
%endif
#
#
Url: http://sourceforge.net/projects/net-snmp
Source: %{pkg_name}-%{version}.tar.bz2
Source1: rc.net-snmp
Source2: snmpd.conf
Source3: README.SuSE
Source4: rc.snmptrapd
Source5: net-snmp.logrotate
Source6: test_installed
Source7: net-snmp.sysconfig
Source8: net-snmp-rpmlintrc
Patch: net-snmp-5.4.2_audit.patch
Patch1: net-snmp-5.4.2_autoconf.patch
# unused patch atm
Patch2: net-snmp-5.2.1-socket_path.diff
Patch3: net-snmp-5.4.rc2-versinfo.diff
Patch4: net-snmp-5.4.2_overflow.patch
Patch5: net-snmp-5.4.2_testing.empty_arptable.patch
Patch6: net-snmp-5.1.1-pie.patch
Patch7: net-snmp-5.4.2_vendorperl.patch
Patch8: net-snmp-5.4.2_net-snmp-config_headercheck.patch
Patch9: net-snmp-5.4.2_perl_tk_warning.patch
Patch10: net-snmp-5.4.2_snmpconf-selinux.patch
Patch11: net-snmp-5.3.0.1_trap-agent-addr_v2.patch
Patch12: net-snmp-5.4.1.2-etherlike-mib-revised_4.patch
Patch13: net-snmp-5.4.1.2-rmon-mib-revised_3.patch
Patch14: net-snmp-5.4.2_velocity-mib.patch
Patch15: Fix-for-tcpConnnectionTable-tcpListenerTable-udpEn.patch
Patch16: Fix-for-IPv6-Interface-Table.patch
Patch17: Fix-for-Internet-Address-Table.patch
Patch18: Add-ICMP-Statistics-Tables-support.patch
Patch19: Add-Default-Router-Table-support.patch
Patch20: Add-IPv6-support-on-Internet-Address-Translation-Tab.patch
Patch21: Fix-for-Internet-Address-Prefix-Table.patch
Patch22: Add-IPv6-Scope-Zone-Index.patch
Patch23: Improve-IP-Statistics-tables.patch
Patch24: net-snmp-5.4.x_embedded_perl_error_message.patch
Patch25: net-snmp-5.4.2.1-rpm4.7.patch
#
Summary: SNMP Daemon
%description
This package was originally based on the CMU 2.1.2.1 snmp code. It has
been greatly modified, restructured, enhanced, and fixed. It hardly
looks the same as anything that CMU has ever released. 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 libsnmp15
%package -n libsnmp15
License: BSD 3-clause (or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
Requires: snmp-mibs = %{version}
# we link libperl
%perl_requires
#
Summary: Shared Libraries from net-snmp
%description -n libsnmp15
This package was originally based on the CMU 2.1.2.1 snmp code. It has
been greatly modified, restructured, enhanced, and fixed. It hardly
looks the same as anything that CMU has ever released. It was renamed
from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp to
net-snmp in November 2000.
This package holds the shared libraries from the net-snmp package.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package devel
License: BSD 3-clause (or similar) ; MIT License (or similar)
Group: Development/Libraries/C and C++
# bug437293
%ifarch ppc64
Obsoletes: net-snmp-devel-64bit
%endif
#
Requires: %{library_name} = %{version}
# for mib2c
Requires: perl-SNMP = %{version}
Requires: openssl-devel rpm-devel tcpd-devel
%if 0%{?with_sensors}
Requires: libsensors3-devel
%endif
#
Summary: SNMP Daemon
%description devel
This package was originally based on the CMU 2.1.2.1 snmp code. It has
been greatly modified, restructured, enhanced, and fixed. It hardly
looks the same as anything that CMU has ever released. 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>
%package -n snmp-mibs
License: BSD 3-clause (or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
#
Summary: MIB files from net-snmp
%description -n snmp-mibs
This package was originally based on the CMU 2.1.2.1 snmp code. It has
been greatly modified, restructured, enhanced, and fixed. It hardly
looks the same as anything that CMU has ever released. It was renamed
from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp to
net-snmp in November 2000.
This package holds the MIB files from the net-snmp package.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package -n perl-SNMP
License: GPL v2 or later
Group: Development/Libraries/Perl
Requires: %{pkg_name} = %{version}
%perl_requires
#
Summary: Perl-SNMP
%description -n perl-SNMP
The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 library.
Authors:
--------
G.S. Marzot <gmarzot@nortelnetworks.com>
%prep
%setup -q -n %{pkg_name}-%{version}
%patch
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12 -p1
%patch13 -p1
%patch14
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24
%patch25
find -name "CVS" -type d | xargs -r %{__rm} -rfv
find -name ".cvsignore" | xargs -r %{__rm} -fv
%build
autoreconf -fi
# possibly add later
# --with-python-modules \ => need python-setuptools
# ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable
export CFLAGS="%{optflags} -fno-strict-aliasing -DNETSNMP_NO_INLINE"
export CFLAGS="%{optflags} -fno-strict-aliasing"
%if 0%{?suse_version} > 1000
export CFLAGS="$CFLAGS -fstack-protector-all"
%endif
%configure \
--with-sys-contact="root@localhost" \
--with-mib-modules="misc/ipfwacc \
ucd-snmp/diskio \
etherlike-mib rmon-mib \
velocity \
%if 0%{?with_sensors}
ucd-snmp/lmSensors \
%endif
smux \
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
ip-mib/ipDefaultRouterTable ip-mib/ipAddressPrefixTable \
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable" \
--with-persistent-directory=/var/lib/net-snmp \
--with-agentx-socket=%{netsnmp_agentx_socket_dir_fhs}/master \
--with-sys-location="unknown" \
--with-logfile=%{netsnmp_logfile} \
--with-libwrap=%{_prefix} \
--with-defaults \
--enable-shared \
--disable-static \
--enable-as-needed \
--without-root-access \
--enable-local-smux \
--enable-ipv6 \
--enable-ucd-snmp-compatibility
%{__make} all
%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 ||:
%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 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
%{__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
%{__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}
#
%clean
%{__rm} -rf %{buildroot}
%preun
%stop_on_removal snmpd
%post
# if we are upgrading from older distros the config should be moved
# to the new place
CONFD="/etc/snmp"
OCONF="/etc/snmpd.conf"
NCONF="${CONFD}/snmpd.conf"
NCONFB="${CONFD}/snmpd.conf.rpmsave"
if [ -e "$OCONF" ] ; then
#
# in worst case we will get:
# /etc/snmp/snmpd.conf - the old /etc/snmpd.conf
# /etc/snmp/snmpd.conf.rpmnew - the config of the newly installed package.
# /etc/snmp/snmpd.conf.rpmsave - the old /etc/snmp/snmpd.conf
#
if [ ! -d "$CONFD" ] ; then
mkdir "$CONFD"
fi
#
# we dont need to handle the case that /etc/snmp/snmpd.conf
# exists. rpm does that for us.
# it creates /etc/snmp/snmpd.conf.rpmnew
#
if [ -e "$NCONF" ] ; then
mv "$NCONF" "$NCONFB"
echo "warning: /etc/snmp/snmpd.conf backed up as /etc/snmp/snmpd.conf.rpmsave" >&2
fi
echo "warning: /etc/snmpd.conf moved to /etc/snmp/snmpd.conf" >&2
mv "$OCONF" "$NCONF"
fi
# we might be updating from ucdsnmp soon
/sbin/chkconfig -c snmpd 2> /dev/null && FIRST_ARG=2
%{fillup_only}
%postun
%restart_on_update snmpd
%{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 rc.snmptrapd
%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
%{_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
%dir %{_prefix}/lib/net-snmp
%dir %{_prefix}/lib/net-snmp/agents
%{_mandir}/man[158]/*
%{_sbindir}/*
/var/lib/net-snmp
%dir %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*.la
%{_libdir}/libsnmp*.so
%{_libdir}/libnetsnmp*.la
%{_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
/var/adm/perl-modules/%{name}
%{_bindir}/tkmib
%changelog