Partial specfile cleanup.

OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=191
This commit is contained in:
Petr Tesařík 2020-01-07 14:03:29 +00:00 committed by Git OBS Bridge
parent 020edeafec
commit 3284511b3d

View File

@ -1,7 +1,7 @@
# #
# spec file for package kdump # spec file for package kdump
# #
# Copyright (c) 2019 SUSE LLC # Copyright (c) 2020 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -18,19 +18,19 @@
# on systemd distros, rpm-build requires systemd-rpm-macros, # on systemd distros, rpm-build requires systemd-rpm-macros,
# which in turn defines %systemd_requires # which in turn defines %systemd_requires
%define systemd_present %{defined systemd_requires}
#Compat macro for new _fillupdir macro introduced in Nov 2017 #Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir} %if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates %define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif %endif
%define systemd_present %{defined systemd_requires}
%define dracutlibdir %{_prefix}/lib/dracut %define dracutlibdir %{_prefix}/lib/dracut
%{!?_udevdir: %global _udevdir %(pkg-config --variable=udevdir udev)} %{!?_udevdir: %global _udevdir %(pkg-config --variable=udevdir udev)}
%if "%{_udevdir}" == "" %if "%{_udevdir}" == ""
%if 0%{?suse_version} >= 1230 %if 0%{?suse_version} >= 1230
%global _udevdir /usr/lib/udev %global _udevdir %{_prefix}/lib/udev
%else %else
%global _udevdir /lib/udev %global _udevdir /lib/udev
%endif %endif
@ -88,26 +88,27 @@ BuildRequires: libxslt
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: udev BuildRequires: udev
BuildRequires: zlib-devel BuildRequires: zlib-devel
#!BuildIgnore: fop
Requires: curl Requires: curl
Requires: kexec-tools Requires: kexec-tools
Requires: makedumpfile Requires: makedumpfile
Requires: openssh Requires: openssh
# FIXME: use proper Requires(pre/post/preun/...)
PreReq: %fillup_prereq PreReq: %fillup_prereq
PreReq: coreutils PreReq: coreutils
PreReq: dracut
PreReq: sed PreReq: sed
Recommends: cifs-utils Recommends: cifs-utils
Recommends: nfs-client Recommends: nfs-client
#!BuildIgnore: fop
# update should detect the split-off from kexec-tools # update should detect the split-off from kexec-tools
Provides: kexec-tools:%{_initddir}/kdump Provides: kexec-tools:%{_initddir}/kdump
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExcludeArch: s390 ppc ExcludeArch: s390 ppc
%if %{systemd_present} %if %{systemd_present}
BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(systemd)
%else %else
# FIXME: use proper Requires(pre/post/preun/...)
PreReq: %insserv_prereq PreReq: %insserv_prereq
%endif %endif
PreReq: dracut
%if %{systemd_present} %if %{systemd_present}
%systemd_requires %systemd_requires
%endif %endif
@ -167,35 +168,29 @@ after a crash dump has occured.
%build %build
export CFLAGS="%{optflags}" export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=gnu++98" export CXXFLAGS="%{optflags} -std=gnu++98"
mkdir build %cmake
cd build %cmake_build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} ..
make %{?_smp_mflags}
cd -
%check %check
cd build %ctest
make %{?_smp_mflags} test
%install %install
cd build %cmake_install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
cd -
# move udev rules # move udev rules
mkdir -p %{buildroot}/%{_udevrulesdir} mkdir -p %{buildroot}/%{_udevrulesdir}
mv %{buildroot}/%{_sysconfdir}/udev/rules.d/* %{buildroot}/%{_udevrulesdir}/ mv %{buildroot}/%{_sysconfdir}/udev/rules.d/* %{buildroot}/%{_udevrulesdir}/
# remove executable bit from non-binaries # remove executable bit from non-binaries
chmod -x %{buildroot}/lib/kdump/setup-kdump.functions chmod -x %{buildroot}/lib/kdump/setup-kdump.functions
# empty directory # empty directory
mkdir -p %{buildroot}/var/crash mkdir -p %{buildroot}%{_localstatedir}/crash
# symlink for init script # symlink for init script
%if %{systemd_present} %if %{systemd_present}
rm %{buildroot}%{_initddir}/boot.kdump rm %{buildroot}%{_initddir}/boot.kdump
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rckdump ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rckdump
%else %else
rm %{buildroot}/usr/lib/systemd/system/kdump.service rm %{buildroot}%{_prefix}/lib/systemd/system/kdump.service
rm %{buildroot}/usr/lib/systemd/system/kdump-early.service rm %{buildroot}%{_prefix}/lib/systemd/system/kdump-early.service
ln -s ../..%{_initddir}/boot.kdump %{buildroot}%{_sbindir}/rckdump ln -s ../..%{_initddir}/boot.kdump %{buildroot}%{_sbindir}/rckdump
%endif %endif
@ -217,8 +212,8 @@ fi
%service_add_post kdump.service %service_add_post kdump.service
%service_add_post kdump-early.service %service_add_post kdump-early.service
# ensure newly added kdump-early.service is-enabled matches prior state # ensure newly added kdump-early.service is-enabled matches prior state
if [ -x /usr/bin/systemctl ] && /usr/bin/systemctl is-enabled kdump.service &>/dev/null ; then if [ -x %{_bindir}/systemctl ] && %{_bindir}/systemctl is-enabled kdump.service &>/dev/null ; then
/usr/bin/systemctl reenable kdump.service || : %{_bindir}/systemctl reenable kdump.service || :
fi fi
%else %else
%{fillup_and_insserv -n kdump boot.kdump} %{fillup_and_insserv -n kdump boot.kdump}
@ -227,9 +222,9 @@ if [ "$change_permission" = 1 ]; then
chmod 0600 %{_sysconfdir}/sysconfig/kdump chmod 0600 %{_sysconfdir}/sysconfig/kdump
fi fi
# if /var/log/dump is empty, make it a symlink to /var/crash # if /var/log/dump is empty, make it a symlink to /var/crash
if test -d /var/log/dump && rmdir /var/log/dump >/dev/null 2>&1 || if test -d %{_localstatedir}/log/dump && rmdir %{_localstatedir}/log/dump >/dev/null 2>&1 ||
! test -d /var/log/dump ; then ! test -d %{_localstatedir}/log/dump ; then
ln -snf /var/crash /var/log/dump ln -snf %{_localstatedir}/crash %{_localstatedir}/log/dump
fi fi
%preun %preun
@ -245,7 +240,7 @@ echo "Stopping kdump ..."
# force regeneration of kdumprd # force regeneration of kdumprd
touch %{_sysconfdir}/sysconfig/kdump touch %{_sysconfdir}/sysconfig/kdump
# delete symbolic link # delete symbolic link
rm /var/log/dump >/dev/null 2>&1 || true rm %{_localstatedir}/log/dump >/dev/null 2>&1 || true
%if %{systemd_present} %if %{systemd_present}
%service_del_postun kdump.service %service_del_postun kdump.service
%service_del_postun kdump-early.service %service_del_postun kdump-early.service
@ -261,7 +256,7 @@ rm /var/log/dump >/dev/null 2>&1 || true
%else %else
# filesystem before SLE12 SP3 lacks /usr/share/licenses # filesystem before SLE12 SP3 lacks /usr/share/licenses
%if 0%(test ! -d %{_defaultlicensedir} && echo 1) %if 0%(test ! -d %{_defaultlicensedir} && echo 1)
%define _defaultlicensedir %_defaultdocdir %define _defaultlicensedir %{_defaultdocdir}
%endif %endif
%endif %endif
# End of compatibility cruft # End of compatibility cruft
@ -272,10 +267,10 @@ rm /var/log/dump >/dev/null 2>&1 || true
%doc ChangeLog README NEWS %doc ChangeLog README NEWS
%{_sbindir}/kdumptool %{_sbindir}/kdumptool
%{_sbindir}/mkdumprd %{_sbindir}/mkdumprd
%{_mandir}/man5/kdump.5%{ext_man} %{_mandir}/man5/kdump.5%{?ext_man}
%{_mandir}/man7/kdump.7%{ext_man} %{_mandir}/man7/kdump.7%{?ext_man}
%{_mandir}/man8/kdumptool.8%{ext_man} %{_mandir}/man8/kdumptool.8%{?ext_man}
%{_mandir}/man8/mkdumprd.8%{ext_man} %{_mandir}/man8/mkdumprd.8%{?ext_man}
%{_fillupdir}/sysconfig.kdump %{_fillupdir}/sysconfig.kdump
%dir %{dracutlibdir} %dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d %dir %{dracutlibdir}/modules.d