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:
parent
0e9b265c04
commit
aa2a39700d
@ -8,7 +8,7 @@
|
||||
Summary: A collection of SNMP protocol tools and libraries
|
||||
Name: net-snmp
|
||||
Version: %{major_ver}
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
License: BSD and MIT
|
||||
@ -28,7 +28,6 @@ Patch2: net-snmp-5.5-dir-fix.patch
|
||||
Patch3: net-snmp-5.5-multilib.patch
|
||||
Patch4: net-snmp-5.5-sensors3.patch
|
||||
|
||||
Requires(pre): chkconfig
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
# for /sbin/service
|
||||
@ -43,15 +42,14 @@ BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
|
||||
BuildRequires: perl-devel, perl(ExtUtils::Embed), gawk, procps
|
||||
BuildRequires: python-devel, python-setuptools
|
||||
BuildRequires: chrpath
|
||||
# for netstat, needed by 'make tests'
|
||||
BuildRequires: net-tools
|
||||
%ifnarch s390 s390x
|
||||
BuildRequires: lm_sensors-devel >= 3
|
||||
%endif
|
||||
%if %{tcp_wrappers}
|
||||
BuildRequires: tcp_wrappers-devel
|
||||
%endif
|
||||
BuildRequires: perl, coreutils, grep, sed, findutils
|
||||
|
||||
#%define __libtoolize /bin/true
|
||||
|
||||
%description
|
||||
SNMP (Simple Network Management Protocol) is a protocol used for
|
||||
@ -150,8 +148,6 @@ Net-SNMP toolkit library.
|
||||
|
||||
%prep
|
||||
%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
|
||||
%patch1 -p1 -b .pie
|
||||
@ -161,15 +157,7 @@ Net-SNMP toolkit library.
|
||||
%patch3 -p1 -b .multilib
|
||||
%patch4 -p1 -b .sensors
|
||||
|
||||
# Do this patch with a perl hack...
|
||||
perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh
|
||||
|
||||
%build
|
||||
%ifarch ia64 x86_64 s390x ppc64 sparc64
|
||||
export LDFLAGS="-L%{_libdir}"
|
||||
%endif
|
||||
export LIBDIR="%{_libdir}"
|
||||
|
||||
MIBS="host agentx smux \
|
||||
ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
|
||||
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
|
||||
@ -177,18 +165,15 @@ MIBS="host agentx smux \
|
||||
ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
|
||||
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
|
||||
sctp-mib rmon-mib etherlike-mib"
|
||||
|
||||
%ifnarch s390 s390x
|
||||
# there are no lm_sensors on s390
|
||||
MIBS="$MIBS ucd-snmp/lmsensorsMib"
|
||||
%endif
|
||||
|
||||
%configure \
|
||||
--disable-static --enable-shared \
|
||||
--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-logfile="/var/log/snmpd.log" \
|
||||
--with-persistent-directory="/var/lib/net-snmp" \
|
||||
@ -207,7 +192,6 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib"
|
||||
--enable-mfd-rewrites \
|
||||
--enable-local-smux \
|
||||
--with-sys-contact="root@localhost" <<EOF
|
||||
|
||||
EOF
|
||||
|
||||
# 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
|
||||
make
|
||||
|
||||
# remove rpath from perl libs
|
||||
# remove rpath from compiled perl libs
|
||||
find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
|
||||
|
||||
# compile python module
|
||||
pushd python
|
||||
# built python module building
|
||||
%{__python} setup.py --basedir="../" build
|
||||
popd
|
||||
|
||||
|
||||
%install
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||
@ -237,7 +222,7 @@ basearch=i386
|
||||
|
||||
%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
|
||||
# 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.
|
||||
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
|
||||
@ -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
|
||||
%endif
|
||||
|
||||
# remove .la files
|
||||
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 %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
|
||||
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
|
||||
rm -f ${RPM_BUILD_ROOT}/%{_bindir}/fixproc
|
||||
rm -f ${RPM_BUILD_ROOT}/%{_mandir}/man1/fixproc*
|
||||
rm -f ${RPM_BUILD_ROOT}/%{_bindir}/ipf-mod.pl
|
||||
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/*.la
|
||||
|
||||
# remove docs that do not apply to Linux
|
||||
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
|
||||
install -m 644 local/mib2c.*.conf ${RPM_BUILD_ROOT}%{_datadir}/snmp
|
||||
|
||||
# instal perl module
|
||||
# adjust the perl module
|
||||
pushd perl
|
||||
eval $(perl '-V:installvendorarch')
|
||||
|
||||
@ -317,6 +300,11 @@ done
|
||||
# remove executable bit from documentation samples
|
||||
chmod 644 local/passtest local/ipf-mod.pl
|
||||
|
||||
|
||||
%check
|
||||
LD_LIBRARY_PATH=${RPM_BUILD_ROOT}/%{_libdir} make test
|
||||
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add snmpd
|
||||
/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
|
||||
/bin/mv %{_localstatedir}/net-snmp/* %{_localstatedir}/lib/net-snmp/ &>/dev/null || :
|
||||
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ]; then
|
||||
service snmpd stop >/dev/null 2>&1
|
||||
@ -332,6 +321,7 @@ if [ $1 = 0 ]; then
|
||||
/sbin/chkconfig --del snmptrapd
|
||||
fi
|
||||
|
||||
|
||||
%postun
|
||||
if [ "$1" -ge "1" ]; then
|
||||
service snmpd condrestart >/dev/null 2>&1 || :
|
||||
@ -419,6 +409,12 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%{_datadir}/snmp/mibs/*
|
||||
|
||||
%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
|
||||
- introduce /etc/sysconfig/snmptrapd. Use it to specify snmptrapd command
|
||||
line options. /etc/snmp/snmptrapd.options is not used anymore (#540799)
|
||||
|
Loading…
Reference in New Issue
Block a user