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 Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp Name: net-snmp
Version: %{major_ver} Version: %{major_ver}
Release: 1%{?dist} Release: 2%{?dist}
Epoch: 1 Epoch: 1
License: BSD and MIT 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 Source1: net-snmp.redhat.conf
Source2: net-snmpd.init Source2: net-snmpd.init
Source3: net-snmptrapd.init Source3: net-snmptrapd.init
Source4: net-snmpd.logrotate Source4: net-snmp-config.h
Source5: ucd5820stat Source5: net-snmp-config
Source6: net-snmp-config.h Source6: net-snmp-trapd.redhat.conf
Source7: net-snmp-config Source7: net-snmpd.sysconfig
Source8: net-snmp-trapd.redhat.conf Source8: net-snmptrapd.sysconfig
Source9: net-snmpd.sysconfig
Patch1: net-snmp-5.4.1-pie.patch Patch1: net-snmp-5.4.1-pie.patch
Patch2: net-snmp-5.5-dir-fix.patch Patch2: net-snmp-5.5-dir-fix.patch
Patch3: net-snmp-5.5-multilib.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: libselinux-devel, elfutils-libelf-devel, rpm-devel
BuildRequires: perl-devel, perl(ExtUtils::Embed), gawk, procps BuildRequires: perl-devel, perl(ExtUtils::Embed), gawk, procps
BuildRequires: python-devel, python-setuptools BuildRequires: python-devel, python-setuptools
BuildRequires: chrpath
%ifnarch s390 s390x %ifnarch s390 s390x
BuildRequires: lm_sensors-devel >= 3 BuildRequires: lm_sensors-devel >= 3
%endif %endif
@ -52,7 +52,6 @@ BuildRequires: tcp_wrappers-devel
BuildRequires: perl, coreutils, grep, sed, findutils BuildRequires: perl, coreutils, grep, sed, findutils
#%define __libtoolize /bin/true #%define __libtoolize /bin/true
%{expand: %%define _includedir %{_includedir}/%{name}}
%description %description
SNMP (Simple Network Management Protocol) is a protocol used for SNMP (Simple Network Management Protocol) is a protocol used for
@ -174,7 +173,10 @@ export LIBDIR="%{_libdir}"
MIBS="host agentx smux \ MIBS="host agentx smux \
ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \ ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \ 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 %ifnarch s390 s390x
MIBS="$MIBS ucd-snmp/lmsensorsMib" MIBS="$MIBS ucd-snmp/lmsensorsMib"
%endif %endif
@ -200,21 +202,23 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib"
--with-openssl \ --with-openssl \
--with-pic \ --with-pic \
--enable-embedded-perl \ --enable-embedded-perl \
--enable-as-needed \
--with-perl-modules="INSTALLDIRS=vendor" \
--enable-mfd-rewrites \ --enable-mfd-rewrites \
--enable-local-smux \ --enable-local-smux \
--with-sys-contact="root@localhost" <<EOF --with-sys-contact="root@localhost" <<EOF
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 # the package is not %_smp_mflags safe
# Use just built libs for perl module building, not the system libs. make
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" # remove rpath from perl libs
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 find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
make %{?smp_mflags}
popd
pushd python pushd python
# built python module building # built python module building
@ -223,24 +227,22 @@ popd
%install %install
rm -rf ${RPM_BUILD_ROOT} rm -rf ${RPM_BUILD_ROOT}
%makeinstall ucdincludedir=${RPM_BUILD_ROOT}/usr/include/ucd-snmp make install DESTDIR=${RPM_BUILD_ROOT}
# Determine which arch net-snmp-config.h is going to try to #include.
# Determine which arch opensslconf.h is going to try to #include.
basearch=%{_arch} basearch=%{_arch}
%ifarch %{ix86} %ifarch %{ix86}
basearch=i386 basearch=i386
%endif %endif
%ifarch %{multilib_arches} %ifarch %{multilib_arches}
# Do an net-snmp-config.h switcheroo to avoid file conflicts on systems where you # 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 # 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. # 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} 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 install -m 755 %SOURCE5 ${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 mv ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config-${basearch}.h
install -m644 %SOURCE6 ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp-config.h install -m644 %SOURCE4 ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h
%endif %endif
# remove .la files # remove .la files
@ -248,75 +250,79 @@ rm ${RPM_BUILD_ROOT}%{_libdir}/*.la
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp
install -m 644 %SOURCE1 ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmpd.conf 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 -d ${RPM_BUILD_ROOT}%{_initrddir}
install -m 755 %SOURCE2 ${RPM_BUILD_ROOT}%{_initrddir}/snmpd install -m 755 %SOURCE2 ${RPM_BUILD_ROOT}%{_initrddir}/snmpd
install -m 755 %SOURCE3 ${RPM_BUILD_ROOT}%{_initrddir}/snmptrapd install -m 755 %SOURCE3 ${RPM_BUILD_ROOT}%{_initrddir}/snmptrapd
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
install -m 644 %SOURCE9 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/snmpd install -m 644 %SOURCE7 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/snmpd
install -m 644 %SOURCE8 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/snmptrapd
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
# prepare /var/lib/net-snmp
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/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}/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 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 # 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 pushd perl
make install_vendor
eval $(perl '-V:installvendorarch') eval $(perl '-V:installvendorarch')
# remove special files # remove special perl files
find $RPM_BUILD_ROOT -name perllocal.pod \ find $RPM_BUILD_ROOT -name perllocal.pod \
-o -name .packlist \ -o -name .packlist \
-o -name "*.bs" \ -o -name "*.bs" \
-o -name Makefile.subs.pl \ -o -name Makefile.subs.pl \
| xargs -ri rm -f {} | xargs -ri rm -f {}
# build files list # build perl files list
find $RPM_BUILD_ROOT/$installvendorarch -type f -print \ find $RPM_BUILD_ROOT/$installvendorarch -type f -print \
-o -type d -a -printf '%%%%dir %%p\n' \ -o -type d -a -printf '%%%%dir %%p\n' \
| sed "s@$RPM_BUILD_ROOT@@g" \ | sed "s@$RPM_BUILD_ROOT@@g" \
| grep -v "$installvendorarch\$" \ | grep -v "$installvendorarch\$" \
| grep -v '/auto$' \ | grep -v '/auto$' \
> ../perl.lst > ../perl.lst
popd popd
# install python module
pushd python 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 popd
find $RPM_BUILD_ROOT -name '*.so' | xargs chmod 0755 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 # trim down massive ChangeLog
dd bs=1024 count=250 if=ChangeLog of=ChangeLog.trimmed 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 %post
/sbin/chkconfig --add snmpd /sbin/chkconfig --add snmpd
/sbin/chkconfig --add snmptrapd /sbin/chkconfig --add snmptrapd
# move local state files from /var/net-snmp to new location when updating the package # 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 %preun
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
@ -324,8 +330,6 @@ if [ $1 = 0 ]; then
/sbin/chkconfig --del snmpd /sbin/chkconfig --del snmpd
service snmptrapd stop >/dev/null 2>&1 service snmptrapd stop >/dev/null 2>&1
/sbin/chkconfig --del snmptrapd /sbin/chkconfig --del snmptrapd
# remove stale autogenerated file
rm -f %{_datadir}/snmp/mibs/.index
fi fi
%postun %postun
@ -345,17 +349,15 @@ rm -rf ${RPM_BUILD_ROOT}
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc COPYING ChangeLog.trimmed EXAMPLE.conf FAQ NEWS TODO %doc COPYING ChangeLog.trimmed EXAMPLE.conf FAQ NEWS TODO
%doc README README.agent-mibs README.agentx README.krb5 README.snmpv3 %doc README README.agent-mibs README.agentx README.krb5 README.snmpv3
%doc local/passtest %doc local/passtest local/ipf-mod.pl
%doc README.thread AGENT.txt PORTING local/README.mib2c local/ipf-mod.pl %doc README.thread AGENT.txt PORTING local/README.mib2c
%{_initrddir}/snmpd %{_initrddir}/snmpd
%{_initrddir}/snmptrapd %{_initrddir}/snmptrapd
%config(noreplace) %{_sysconfdir}/logrotate.d/snmpd
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/snmpd %config(noreplace,missingok) %{_sysconfdir}/sysconfig/snmpd
%config(noreplace,missingok) %{_sysconfdir}/sysconfig/snmptrapd
%dir %{_sysconfdir}/snmp %dir %{_sysconfdir}/snmp
%config(noreplace,missingok) %{_sysconfdir}/snmp/snmpd.conf %config(noreplace,missingok) %{_sysconfdir}/snmp/snmpd.conf
%config(noreplace,missingok) %{_sysconfdir}/snmp/snmptrapd.conf %config(noreplace,missingok) %{_sysconfdir}/snmp/snmptrapd.conf
%{_bindir}/ucd5820stat
%{_bindir}/ipf-mod.pl
%{_bindir}/snmpconf %{_bindir}/snmpconf
%{_bindir}/net-snmp-create-v3-user %{_bindir}/net-snmp-create-v3-user
%{_sbindir}/* %{_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/snmp_config.5.gz
%attr(0644,root,root) %{_mandir}/man5/variables* %attr(0644,root,root) %{_mandir}/man5/variables*
%attr(0644,root,root) %{_mandir}/man1/net-snmp-create-v3-user* %attr(0644,root,root) %{_mandir}/man1/net-snmp-create-v3-user*
%attr(0644,root,root) %{_mandir}/man1/snmpconf.1.gz
%dir %{_datadir}/snmp %dir %{_datadir}/snmp
%{_datadir}/snmp/snmpconf-data %{_datadir}/snmp/snmpconf-data
%dir %{_localstatedir}/lib/net-snmp %dir %{_localstatedir}/lib/net-snmp
@ -409,12 +412,23 @@ rm -rf ${RPM_BUILD_ROOT}
%files libs %files libs
%defattr(-,root,root) %defattr(-,root,root)
%doc COPYING README ChangeLog.trimmed FAQ NEWS TODO
%{_libdir}/lib*.so.* %{_libdir}/lib*.so.*
%dir %{_datadir}/snmp %dir %{_datadir}/snmp
%dir %{_datadir}/snmp/mibs %dir %{_datadir}/snmp/mibs
%{_datadir}/snmp/mibs %{_datadir}/snmp/mibs/*
%changelog %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 * Tue Sep 29 2009 Jan Safranek Jan Safranek <jsafranek@redhat.com> 5.5-1
- update to Net-SNMP 5.5 - update to Net-SNMP 5.5
- remove static libraries from -devel subpackage - remove static libraries from -devel subpackage

View File

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

2
net-snmptrapd.sysconfig Normal file
View File

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