Another round of .spec adjusting:

- run automatic regression suite after the compilation of the package
    (%check section added)
- remove unnecessary package dependencies
- remove unnecessary LD_FLAGS
- minor .spec cleanup
This commit is contained in:
Jan Šafránek 2009-11-27 09:32:14 +00:00
parent 0e9b265c04
commit aa2a39700d

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: 2%{?dist} Release: 3%{?dist}
Epoch: 1 Epoch: 1
License: BSD and MIT License: BSD and MIT
@ -28,7 +28,6 @@ Patch2: net-snmp-5.5-dir-fix.patch
Patch3: net-snmp-5.5-multilib.patch Patch3: net-snmp-5.5-multilib.patch
Patch4: net-snmp-5.5-sensors3.patch Patch4: net-snmp-5.5-sensors3.patch
Requires(pre): chkconfig
Requires(post): chkconfig Requires(post): chkconfig
Requires(preun): chkconfig Requires(preun): chkconfig
# for /sbin/service # for /sbin/service
@ -43,15 +42,14 @@ 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 BuildRequires: chrpath
# for netstat, needed by 'make tests'
BuildRequires: net-tools
%ifnarch s390 s390x %ifnarch s390 s390x
BuildRequires: lm_sensors-devel >= 3 BuildRequires: lm_sensors-devel >= 3
%endif %endif
%if %{tcp_wrappers} %if %{tcp_wrappers}
BuildRequires: tcp_wrappers-devel BuildRequires: tcp_wrappers-devel
%endif %endif
BuildRequires: perl, coreutils, grep, sed, findutils
#%define __libtoolize /bin/true
%description %description
SNMP (Simple Network Management Protocol) is a protocol used for SNMP (Simple Network Management Protocol) is a protocol used for
@ -150,8 +148,6 @@ Net-SNMP toolkit library.
%prep %prep
%setup -q -n %{name}-%{major_ver} %setup -q -n %{name}-%{major_ver}
# TODO: check, there is /etc/mtab in net-snmp-config.h on all architectures
# %patch1 -p1 -b .mnttab
%ifnarch ia64 %ifnarch ia64
%patch1 -p1 -b .pie %patch1 -p1 -b .pie
@ -161,15 +157,7 @@ Net-SNMP toolkit library.
%patch3 -p1 -b .multilib %patch3 -p1 -b .multilib
%patch4 -p1 -b .sensors %patch4 -p1 -b .sensors
# Do this patch with a perl hack...
perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh
%build %build
%ifarch ia64 x86_64 s390x ppc64 sparc64
export LDFLAGS="-L%{_libdir}"
%endif
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 \
@ -177,18 +165,15 @@ MIBS="host agentx smux \
ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \ ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \ ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
sctp-mib rmon-mib etherlike-mib" sctp-mib rmon-mib etherlike-mib"
%ifnarch s390 s390x %ifnarch s390 s390x
# there are no lm_sensors on s390
MIBS="$MIBS ucd-snmp/lmsensorsMib" MIBS="$MIBS ucd-snmp/lmsensorsMib"
%endif %endif
%configure \ %configure \
--disable-static --enable-shared \ --disable-static --enable-shared \
--with-cflags="$RPM_OPT_FLAGS -D_RPM_4_4_COMPAT" \ --with-cflags="$RPM_OPT_FLAGS -D_RPM_4_4_COMPAT" \
%ifnarch s390 s390x
--with-ldflags="$LDFLAGS -lcrypto -lsensors" \
%else
--with-ldflags="$LDFLAGS -lcrypto" \
%endif
--with-sys-location="Unknown" \ --with-sys-location="Unknown" \
--with-logfile="/var/log/snmpd.log" \ --with-logfile="/var/log/snmpd.log" \
--with-persistent-directory="/var/lib/net-snmp" \ --with-persistent-directory="/var/lib/net-snmp" \
@ -207,7 +192,6 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib"
--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
# remove rpath from libtool # remove rpath from libtool
@ -217,14 +201,15 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
# the package is not %_smp_mflags safe # the package is not %_smp_mflags safe
make make
# remove rpath from perl libs # remove rpath from compiled perl libs
find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \; find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
# compile python module
pushd python pushd python
# built python module building
%{__python} setup.py --basedir="../" build %{__python} setup.py --basedir="../" build
popd popd
%install %install
rm -rf ${RPM_BUILD_ROOT} rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=${RPM_BUILD_ROOT} make install DESTDIR=${RPM_BUILD_ROOT}
@ -237,7 +222,7 @@ basearch=i386
%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, as 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 %SOURCE5 ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config install -m 755 %SOURCE5 ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config
@ -245,9 +230,6 @@ mv ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h ${RPM_BUILD_ROOT}
install -m644 %SOURCE4 ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h install -m644 %SOURCE4 ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h
%endif %endif
# remove .la files
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 %SOURCE6 ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmptrapd.conf install -m 644 %SOURCE6 ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmptrapd.conf
@ -267,9 +249,10 @@ install -d ${RPM_BUILD_ROOT}%{_localstatedir}/lib/net-snmp
rm -f ${RPM_BUILD_ROOT}%{_bindir}/snmpinform rm -f ${RPM_BUILD_ROOT}%{_bindir}/snmpinform
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}/snmpcheck
rm -f $RPM_BUILD_ROOT/%{_bindir}/fixproc rm -f ${RPM_BUILD_ROOT}/%{_bindir}/fixproc
rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/fixproc* rm -f ${RPM_BUILD_ROOT}/%{_mandir}/man1/fixproc*
rm -f $RPM_BUILD_ROOT/%{_bindir}/ipf-mod.pl rm -f ${RPM_BUILD_ROOT}/%{_bindir}/ipf-mod.pl
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/*.la
# remove docs that do not apply to Linux # remove docs that do not apply to Linux
rm -f README.aix README.hpux11 README.osX README.Panasonic_AM3X.txt README.solaris README.win32 rm -f README.aix README.hpux11 README.osX README.Panasonic_AM3X.txt README.solaris README.win32
@ -277,7 +260,7 @@ rm -f README.aix README.hpux11 README.osX README.Panasonic_AM3X.txt README.solar
# copy missing mib2c.conf files # copy missing mib2c.conf files
install -m 644 local/mib2c.*.conf ${RPM_BUILD_ROOT}%{_datadir}/snmp install -m 644 local/mib2c.*.conf ${RPM_BUILD_ROOT}%{_datadir}/snmp
# instal perl module # adjust the perl module
pushd perl pushd perl
eval $(perl '-V:installvendorarch') eval $(perl '-V:installvendorarch')
@ -317,6 +300,11 @@ done
# remove executable bit from documentation samples # remove executable bit from documentation samples
chmod 644 local/passtest local/ipf-mod.pl chmod 644 local/passtest local/ipf-mod.pl
%check
LD_LIBRARY_PATH=${RPM_BUILD_ROOT}/%{_libdir} make test
%post %post
/sbin/chkconfig --add snmpd /sbin/chkconfig --add snmpd
/sbin/chkconfig --add snmptrapd /sbin/chkconfig --add snmptrapd
@ -324,6 +312,7 @@ chmod 644 local/passtest local/ipf-mod.pl
# 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
/bin/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
service snmpd stop >/dev/null 2>&1 service snmpd stop >/dev/null 2>&1
@ -332,6 +321,7 @@ if [ $1 = 0 ]; then
/sbin/chkconfig --del snmptrapd /sbin/chkconfig --del snmptrapd
fi fi
%postun %postun
if [ "$1" -ge "1" ]; then if [ "$1" -ge "1" ]; then
service snmpd condrestart >/dev/null 2>&1 || : service snmpd condrestart >/dev/null 2>&1 || :
@ -419,6 +409,12 @@ rm -rf ${RPM_BUILD_ROOT}
%{_datadir}/snmp/mibs/* %{_datadir}/snmp/mibs/*
%changelog %changelog
* Wed Nov 25 2009 Jan Safranek <jsafrane@redhat.com> 1:5.5-3
- prepare the .spec file for review
- run automatic regression suite after the compilation of the package
to check for obvious regressions
- remove unnecessary package dependencies
* Tue Nov 24 2009 Jan Safranek <jsafrane@redhat.com> 1:5.5-2 * Tue Nov 24 2009 Jan Safranek <jsafrane@redhat.com> 1:5.5-2
- introduce /etc/sysconfig/snmptrapd. Use it to specify snmptrapd command - introduce /etc/sysconfig/snmptrapd. Use it to specify snmptrapd command
line options. /etc/snmp/snmptrapd.options is not used anymore (#540799) line options. /etc/snmp/snmptrapd.options is not used anymore (#540799)