LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File crash.spec of Package crash (Project Kernel:kdump)

#
# spec file for package crash
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define crash_version		6.0.7
%define whitepaper_version 2003
%define scripts_version  2008-02-08
%define gcore_version  2011-09-22

Name:           crash
%ifarch ppc
%define build_sial 0
%else
%define build_sial 1
%endif
%ifarch %ix86 x86_64
%define build_gcore 1
%else
%define build_gcore 0
%endif
%define build_kmp 1
Url:            http://people.redhat.com/anderson/
Summary:        Crash utility for live systems; netdump, diskdump, LKCD or mcore dumpfiles
License:        GPL-3.0+ ; GFDL-1.2
Group:          Development/Tools/Debuggers
Version:        %{crash_version}
Release:        0
Source:         %{name}-%{version}.tar.gz
Source2:        crash_whitepaper-%{whitepaper_version}.tar.bz2
Source3:        README.SUSE
Source4:        sial-scripts-%{scripts_version}.tar.bz2
Source5:        gcore-%{gcore_version}.tar.bz2
Source95:       get-kernel-flavors.sh
Source96:       depmod.sh
Source97:       mkinitrd.sh
Source98:       %{name}-kmp-preamble
Source99:       rpmlintrc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Patch1:         %{name}-make-emacs-default.diff
Patch2:         %{name}-sles9-quirk.patch
Patch4:         %{name}-sles9-time.patch
Patch6:         %{name}-crosscrash-hint.diff
Patch7:         %{name}-rl_digit_loop-return.patch
Patch8:         %{name}-missing-declarations.patch
Patch9:         %{name}-debuginfo-compressed.patch
Patch10:        %{name}_enable_lzo_support.patch
Patch11:        %{name}-siginfo.patch
Patch12:        %{name}-var_length_log_rec.patch
Patch90:        %{name}-sial-ps-2.6.29.diff
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  lzo-devel
BuildRequires:  ncurses-devel
BuildRequires:  zlib-devel
Requires:       /usr/bin/nm
ExclusiveArch:  %ix86 x86_64 ia64 s390 s390x ppc64 alpha
# Source code says it can do ppc32. Excluded here?
ExcludeArch:    ppc
# crash driver KMP
%if %build_kmp
BuildRequires:  kernel-syms
BuildRequires:  module-init-tools
%if 0%{?suse_version} >= 1130
BuildRequires:  kernel-devel
%endif
%endif

%if %build_kmp
%if 0%{?suse_version} >= 920
%suse_kernel_module_package -n crash -p %_sourcedir/%{name}-kmp-preamble um
%define arch %_target_cpu
%define kmp_pkg KMP
%else
%define kver %(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel-source)
%define kver_ %(rpm -q --qf '%{VERSION}_%{RELEASE}' kernel-source)
%define arch %(echo %_target_cpu | sed -e 's/i.86/i386/')
%define flavors_to_build %(sh %_sourcedir/get-kernel-flavors.sh %arch)
%define kmp_pkg kmp
%endif
%endif

%description
The core analysis suite is a self-contained tool that can be used to
investigate either live systems, kernel core dumps created from the
netdump and diskdump packages from Red Hat Linux, the mcore kernel
patch offered by Mission Critical Linux, or the LKCD kernel patch.



Authors:
--------
    David Anderson <anderson@redhat.com>

%package doc
Requires:       %{name} = %{version}
Summary:        Documentation for Crash
License:        GFDL-1.2
Group:          Development/Tools/Debuggers

%description doc
This subpackage contains the crash whitepaper from Dave Anderson.



Authors:
--------
    David Anderson <anderson@redhat.com>

%package devel
Requires:       %{name} = %{version}
Summary:        Development files for crash
License:        GPL-2.0+
Group:          Development/Tools/Debuggers

%description devel
This files are required to build extensions for crash.

Crash is the core analysis suite that can be used to investigate either
live systems, kernel core dumps created from the netdump and diskdump
packages from Red Hat Linux, the mcore kernel patch offered by Mission
Critical Linux, or the LKCD kernel patch.



Authors:
--------
    David Anderson <anderson@redhat.com>

%if %build_sial

%package sial
Requires:       %{name} = %{version}
Summary:        SIAL extension for crash
License:        GPL-2.0+
Group:          Development/Tools/Debuggers

%description sial
This module is a prerequisite for the loading of SIAL scripts.

Upon loading the sial.so object file with extend, any SIAL scripts
located in the /usr/share/sial/crash or $HOME/.sial directories will be
loaded automatically.



Authors:
--------
    David Anderson <anderson@redhat.com>

%endif

%if %build_gcore

%package gcore
Requires:       %{name} = %{version}
Summary:        Gcore extension for crash
License:        GPL-2.0+
Group:          Development/Tools/Debuggers

%description gcore
Create a core dump file of a user-space task that was running in a
kernel dumpfile. 



Authors:
--------
    Daisuke Hatayama  <d.hatayama@jp.fujitsu.com>

%endif

%if %build_kmp

%package %kmp_pkg
Summary:        Memory driver for the crash utility
License:        GPL-2.0
Group:          System/Kernel
%if 0%{?suse_version} < 920
Version:        %{version}_%{kver_}
Release:        0

Requires:       kernel = %kver
%endif

%description %kmp_pkg
To run the crash utility on a live system, a memory device must be present.
Due to many limitations of the /dev/mem interface, a separate kernel module
is provided to access all RAM through the /dev/crash device.

Authors:
--------
    David Anderson <anderson@redhat.com>

%endif

%prep
%setup -q -a 2 -a 4
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
## SIAL patches
cd sial-scripts-%{scripts_version}
%patch90 -p1
cd -
## gcore extension
cd extensions
tar xfvj %{S:5}
cd -
cp %{S:3} .
mkdir kbuild

%build
export CFLAGS="$RPM_OPT_FLAGS -fno-builtin-memset -fno-strict-aliasing"
make RPMPKG="`cat .rh_rpm_package`" %{?jobs:-j%jobs}
make extensions %{?jobs:-j%jobs}
%if %build_kmp
export EXTRA_CFLAGS='-DVERSION=\"%version\"'
for flavor in %flavors_to_build; do
    rm -rf kbuild/$flavor
    cp -r memory_driver kbuild/$flavor
    make -C /usr/src/linux-obj/%arch/$flavor modules \
      M=$PWD/kbuild/$flavor
done
%endif

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_mandir}/man8
install -m 0644 crash.8 %{buildroot}%{_mandir}/man8/crash.8
# devel files
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/crash
install -m 0644 defs.h $RPM_BUILD_ROOT/%{_includedir}/crash
# permissions
chmod 644 COPYING3
# extensions
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
%if %build_gcore
install -m 0644 extensions/gcore.so $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
%endif
%if %build_sial
install -m 0644 extensions/sial.so $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
# scripts
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/sial/crash
install -m 0644 sial-scripts-%{scripts_version}/*.c \
                $RPM_BUILD_ROOT/%{_datadir}/sial/crash
%endif
%if %build_kmp
# memory driver module
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
     make -C /usr/src/linux-obj/%arch/$flavor modules_install \
       M=$PWD/kbuild/$flavor
done

# Ugly SLES9-style KMP
%if 0%{?suse_version} < 920
set -- $(ls $RPM_BUILD_ROOT/lib/modules)
KERNELRELEASES=$*

set -- $(find $RPM_BUILD_ROOT/lib/modules -type f -name '*.ko' \
	 | sed -e 's:.*/::' -e 's:\.ko$::' | sort -u)
MODULES=$*

(   cat <<-EOF
	# IMPORTANT: Do not change the KERNELRELEASES definition; it will be
	# replaced during driver reuse!
	KERNELRELEASES="$KERNELRELEASES"
	MODULES="$MODULES"
	EOF
    cat %_sourcedir/depmod.sh
    cat %_sourcedir/mkinitrd.sh
) > post_postun.sh

%post kmp -f post_postun.sh

%postun kmp -f post_postun.sh

%endif

%endif

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%{_bindir}/crash
%{_mandir}/man8/crash.8*
%doc README README.SUSE COPYING3
%dir %{_libdir}/crash
%dir %{_libdir}/crash/extensions

%files devel
%defattr(-,root,root)
%{_includedir}/*

%files doc
%defattr(-,root,root)
%doc crash_whitepaper/*

%if %build_sial

%files sial
%defattr(-,root,root)
%doc extensions/libsial/README
%{_libdir}/crash/extensions/sial.so
%{_datadir}/sial/crash
%dir %{_datadir}/sial
%endif

%if %build_gcore

%files gcore
%defattr(-,root,root)
%{_libdir}/crash/extensions/gcore.so
%doc extensions/README.gcore
%endif

%if build_kmp
%if 0%{?suse_version} < 920

%files %kmp_pkg
%defattr(-,root,root)
/lib/modules/*
%endif
%endif

%changelog