Prepare the package for review and clean in, when looknig at it. This

includes lot of changes, including:
- remove tab characters, rpmlint does not like mix of tabs and spaces
- remove logrotate config, snmpd logs to syslog (/var/log/messages)
- remove ucd5820stat, it depends on ucd5820stat
- add sample net-snmptrapd.sysconfig and use /etc/sysconfig/snmptrapd
    instead of /etc/snmpd/*.options
- remove rpath from all executables and libraries
- compile some additional MIBs and OIDs
- simplify perl and python compilation
- convert documentation files to UTF-8 Resolves: #540799 Related: #226192
This commit is contained in:
Jan Šafránek 2009-11-25 15:22:55 +00:00
parent efe9a18fdc
commit 0ab722d645
3 changed files with 120 additions and 104 deletions

View File

@ -8,7 +8,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: %{major_ver}
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 1
License: BSD and MIT
@ -18,12 +18,11 @@ Source0: http://dl.sourceforge.net/net-snmp/net-snmp-%{major_ver}.tar.gz
Source1: net-snmp.redhat.conf
Source2: net-snmpd.init
Source3: net-snmptrapd.init
Source4: net-snmpd.logrotate
Source5: ucd5820stat
Source6: net-snmp-config.h
Source7: net-snmp-config
Source8: net-snmp-trapd.redhat.conf
Source9: net-snmpd.sysconfig
Source4: net-snmp-config.h
Source5: net-snmp-config
Source6: net-snmp-trapd.redhat.conf
Source7: net-snmpd.sysconfig
Source8: net-snmptrapd.sysconfig
Patch1: net-snmp-5.4.1-pie.patch
Patch2: net-snmp-5.5-dir-fix.patch
Patch3: net-snmp-5.5-multilib.patch
@ -43,6 +42,7 @@ BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
BuildRequires: perl-devel, perl(ExtUtils::Embed), gawk, procps
BuildRequires: python-devel, python-setuptools
BuildRequires: chrpath
%ifnarch s390 s390x
BuildRequires: lm_sensors-devel >= 3
%endif
@ -52,7 +52,6 @@ BuildRequires: tcp_wrappers-devel
BuildRequires: perl, coreutils, grep, sed, findutils
#%define __libtoolize /bin/true
%{expand: %%define _includedir %{_includedir}/%{name}}
%description
SNMP (Simple Network Management Protocol) is a protocol used for
@ -174,7 +173,10 @@ export LIBDIR="%{_libdir}"
MIBS="host agentx smux \
ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
ip-mib/ipAddressPrefixTable/ipAddressPrefixTable"
ip-mib/ipAddressPrefixTable/ipAddressPrefixTable \
ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
sctp-mib rmon-mib etherlike-mib"
%ifnarch s390 s390x
MIBS="$MIBS ucd-snmp/lmsensorsMib"
%endif
@ -200,21 +202,23 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib"
--with-openssl \
--with-pic \
--enable-embedded-perl \
--enable-as-needed \
--with-perl-modules="INSTALLDIRS=vendor" \
--enable-mfd-rewrites \
--enable-local-smux \
--with-sys-contact="root@localhost" <<EOF
EOF
make %{?_smp_mflags}
# remove rpath from libtool
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
pushd perl
# Use just built libs for perl module building, not the system libs.
export NETSNMP_DONT_CHECK_VERSION=1
perl Makefile.PL -NET-SNMP-IN-SOURCE=true PREFIX=${RPM_BUILD_ROOT}/%{_prefix} INSTALLDIRS=vendor -NET-SNMP-CONFIG="sh ../../net-snmp-config"
perl -pi -e 's/^LD_RUN_PATH.*//;s/LD_RUN_PATH=\".*\" //;' default_store/Makefile OID/Makefile agent/Makefile agent/default_store/Makefile ASN/Makefile SNMP/Makefile
make %{?smp_mflags}
popd
# the package is not %_smp_mflags safe
make
# remove rpath from perl libs
find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
pushd python
# built python module building
@ -223,24 +227,22 @@ popd
%install
rm -rf ${RPM_BUILD_ROOT}
%makeinstall ucdincludedir=${RPM_BUILD_ROOT}/usr/include/ucd-snmp
make install DESTDIR=${RPM_BUILD_ROOT}
# Determine which arch opensslconf.h is going to try to #include.
# Determine which arch net-snmp-config.h is going to try to #include.
basearch=%{_arch}
%ifarch %{ix86}
basearch=i386
%endif
%ifarch %{multilib_arches}
# Do an net-snmp-config.h switcheroo to avoid file conflicts on systems where you
# can have both a 32- and 64-bit version of the library, and they each need
# their own correct-but-different versions of net-snmp-config.h to be usable.
mv ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config-${basearch}
install -m 755 %SOURCE7 ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config
mv ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp-config.h ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp-config-${basearch}.h
install -m644 %SOURCE6 ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp-config.h
install -m 755 %SOURCE5 ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config
mv ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config-${basearch}.h
install -m644 %SOURCE4 ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h
%endif
# remove .la files
@ -248,75 +250,79 @@ rm ${RPM_BUILD_ROOT}%{_libdir}/*.la
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp
install -m 644 %SOURCE1 ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmpd.conf
install -m 644 %SOURCE8 ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmptrapd.conf
install -m 644 %SOURCE6 ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmptrapd.conf
install -d ${RPM_BUILD_ROOT}%{_initrddir}
install -m 755 %SOURCE2 ${RPM_BUILD_ROOT}%{_initrddir}/snmpd
install -m 755 %SOURCE3 ${RPM_BUILD_ROOT}%{_initrddir}/snmptrapd
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
install -m 644 %SOURCE9 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/snmpd
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
install -m 644 %{SOURCE4} ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/snmpd
install -d ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 %SOURCE5 ${RPM_BUILD_ROOT}%{_bindir}/ucd5820stat
install -m 644 %SOURCE7 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/snmpd
install -m 644 %SOURCE8 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/snmptrapd
# prepare /var/lib/net-snmp
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/lib/net-snmp
# remove things we don't want to distribute
rm -f ${RPM_BUILD_ROOT}%{_bindir}/snmpinform
rm -f ${RPM_BUILD_ROOT}%{_bindir}/snmpcheck
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/snmpconf.1*
ln -s snmptrap ${RPM_BUILD_ROOT}/usr/bin/snmpinform
rm -f ${RPM_BUILD_ROOT}%{_bindir}/snmpcheck
rm -f $RPM_BUILD_ROOT/%{_bindir}/fixproc
rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/fixproc*
rm -f $RPM_BUILD_ROOT/%{_bindir}/ipf-mod.pl
# remove docs that do not apply to Linux
rm -f README.aix README.hpux11 README.osX README.Panasonic_AM3X.txt README.solaris README.win32
# copy missing mib2c.conf files
cp local/mib2c.*.conf ${RPM_BUILD_ROOT}%{_datadir}/snmp
install -m 644 local/mib2c.*.conf ${RPM_BUILD_ROOT}%{_datadir}/snmp
# instal perl module
pushd perl
make install_vendor
eval $(perl '-V:installvendorarch')
# remove special files
# remove special perl files
find $RPM_BUILD_ROOT -name perllocal.pod \
-o -name .packlist \
-o -name "*.bs" \
-o -name Makefile.subs.pl \
| xargs -ri rm -f {}
# build files list
# build perl files list
find $RPM_BUILD_ROOT/$installvendorarch -type f -print \
-o -type d -a -printf '%%%%dir %%p\n' \
| sed "s@$RPM_BUILD_ROOT@@g" \
| grep -v "$installvendorarch\$" \
| grep -v '/auto$' \
> ../perl.lst
popd
# install python module
pushd python
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%{__python} setup.py --basedir=.. install -O1 --skip-build --root $RPM_BUILD_ROOT
popd
find $RPM_BUILD_ROOT -name '*.so' | xargs chmod 0755
# remove docs that do not apply to Linux
for file in "README.aix README.hpux11 README.osX README.Panasonic_AM3X.txt README.solaris README.win32"
do
rm $file
done
rm $RPM_BUILD_ROOT/%{_bindir}/fixproc
rm $RPM_BUILD_ROOT/%{_mandir}/man1/fixproc*
# trim down massive ChangeLog
dd bs=1024 count=250 if=ChangeLog of=ChangeLog.trimmed
# convert files to UTF-8
for file in README COPYING; do
iconv -f 8859_1 -t UTF-8 <$file >$file.utf8
mv $file.utf8 $file
done
# remove executable bit from documentation samples
chmod 644 local/passtest local/ipf-mod.pl
%post
/sbin/chkconfig --add snmpd
/sbin/chkconfig --add snmptrapd
# move local state files from /var/net-snmp to new location when updating the package
mv %{_localstatedir}/net-snmp/* %{_localstatedir}/lib/net-snmp/ &>/dev/null || :
/bin/mv %{_localstatedir}/net-snmp/* %{_localstatedir}/lib/net-snmp/ &>/dev/null || :
%preun
if [ $1 = 0 ]; then
@ -324,8 +330,6 @@ if [ $1 = 0 ]; then
/sbin/chkconfig --del snmpd
service snmptrapd stop >/dev/null 2>&1
/sbin/chkconfig --del snmptrapd
# remove stale autogenerated file
rm -f %{_datadir}/snmp/mibs/.index
fi
%postun
@ -345,17 +349,15 @@ rm -rf ${RPM_BUILD_ROOT}
%defattr(-,root,root,-)
%doc COPYING ChangeLog.trimmed EXAMPLE.conf FAQ NEWS TODO
%doc README README.agent-mibs README.agentx README.krb5 README.snmpv3
%doc local/passtest
%doc README.thread AGENT.txt PORTING local/README.mib2c local/ipf-mod.pl
%doc local/passtest local/ipf-mod.pl
%doc README.thread AGENT.txt PORTING local/README.mib2c
%{_initrddir}/snmpd
%{_initrddir}/snmptrapd
%config(noreplace) %{_sysconfdir}/logrotate.d/snmpd
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/snmpd
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/snmptrapd
%dir %{_sysconfdir}/snmp
%config(noreplace,missingok) %{_sysconfdir}/snmp/snmpd.conf
%config(noreplace,missingok) %{_sysconfdir}/snmp/snmptrapd.conf
%{_bindir}/ucd5820stat
%{_bindir}/ipf-mod.pl
%{_bindir}/snmpconf
%{_bindir}/net-snmp-create-v3-user
%{_sbindir}/*
@ -363,6 +365,7 @@ rm -rf ${RPM_BUILD_ROOT}
%attr(0644,root,root) %{_mandir}/man5/snmp_config.5.gz
%attr(0644,root,root) %{_mandir}/man5/variables*
%attr(0644,root,root) %{_mandir}/man1/net-snmp-create-v3-user*
%attr(0644,root,root) %{_mandir}/man1/snmpconf.1.gz
%dir %{_datadir}/snmp
%{_datadir}/snmp/snmpconf-data
%dir %{_localstatedir}/lib/net-snmp
@ -409,12 +412,23 @@ rm -rf ${RPM_BUILD_ROOT}
%files libs
%defattr(-,root,root)
%doc COPYING README ChangeLog.trimmed FAQ NEWS TODO
%{_libdir}/lib*.so.*
%dir %{_datadir}/snmp
%dir %{_datadir}/snmp/mibs
%{_datadir}/snmp/mibs
%{_datadir}/snmp/mibs/*
%changelog
* Tue Nov 24 2009 Jan Safranek <jsafrane@redhat.com> 1:5.5-2
- introduce /etc/sysconfig/snmptrapd. Use it to specify snmptrapd command
line options. /etc/snmp/snmptrapd.options is not used anymore (#540799)
- build-in ipAddressPrefixTable, ipDefaultRouterTable, ipv6ScopeZoneIndexTable,
ipIfStatsTable, SCTP-MIB, RMON-MIB and Etherlike-MIBs
- remove ucd5820stat helper script, it depends on get5820stats, which is not
available in Fedora
- move sample services ipf-mod.pl to documentation
- remove logrotate config, snmpd logs into syslog
* Tue Sep 29 2009 Jan Safranek Jan Safranek <jsafranek@redhat.com> 5.5-1
- update to Net-SNMP 5.5
- remove static libraries from -devel subpackage

View File

@ -26,8 +26,8 @@
# source function library
. /etc/init.d/functions
if [ -e /etc/snmp/snmptrapd.options ]; then
. /etc/snmp/snmptrapd.options
if [ -e /etc/sysconfig/snmptrapd ]; then
. /etc/sysconfig/snmptrapd
else
OPTIONS="-Lsd -p /var/run/snmptrapd.pid"
fi

2
net-snmptrapd.sysconfig Normal file
View File

@ -0,0 +1,2 @@
# snmptrapd command line options
# OPTIONS="-Lsd -p /var/run/snmptrapd.pid"