File apport.spec of Package apport

#
# spec file for package apport (Version 0.114)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2007-2008 Nikolay Derkach <nderkach@gmail.com>
#
# 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/
#

# norootforbuild

%define revno -rev1189

Name:           apport
Summary:        Automatic crash handler
Version:        0.114
Release:        20
License:        GPLv2+
Url:            https://launchpad.net/apport
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  intltool python-devel texlive-latex
AutoReqProv:    on
Requires:       python python-m2crypto python-xml python-zypp rpm-python
Requires:       apport-crashdb
# Need the ability to use pipes in /proc/sys/kernel/core_pattern
Conflicts:      kernel < 2.6.24
Requires:       coreutils cron binutils gdb lsb-release module-init-tools ptools
Source0:        %{name}-%{version}%{revno}.tar.bz2
Source1:        rc.apport
Source2:        crashdb.conf
Source3:        crashdb.pem
Source4:        crashdb-gencert
Source99:       apport-rpmlintrc
Patch0:         apport-report_append.diff
Patch1:         apport-lp357024.diff
Patch2:         apport-fix_fail_msg.diff
Patch3:         apport-cli_use_less.patch
Patch4:         apport-anonymize-report.patch
Group:          System/Monitoring

%description
Apport automatically collects data from crashed processes and compiles
a problem report in /var/crash/.

See http://opensuse.org/Interactive_Crash_Analysis for more
information.

%package crashdb-opensuse
License:        GPLv2+
Summary:        Automatic crash handler
Group:          System/Monitoring
Requires:       apport = %{version}-%{release}
Requires:       python-m2crypto python-base >= 2.6
Provides:       apport-crashdb

%description crashdb-opensuse
Apport automatically collects data from crashed processes and compiles
a problem report in /var/crash/.

See http://opensuse.org/Interactive_Crash_Analysis for more
information.

%package gtk
License:        GPLv2+
Summary:        GTK frontend for the apport crash report system
Group:          System/Monitoring
Requires:       python-gtk procps
Requires:       apport = %{version}-%{release}
Supplements:    packageand(apport:python-gtk)

%description gtk
This package contains the GTK frontend for the apport crash report system.

%package qt
License:        GPLv2+
Summary:        Qt4 frontend for the apport crash report system
Group:          System/Monitoring
Requires:       python-qt4 procps
Requires:       apport = %{version}-%{release}
Supplements:    packageand(apport:python-qt4)

%description qt
This package contains the Qt4 frontend for the apport crash report system.

%prep
%setup -q -n apport-%{version}
%patch0 -p1
%patch1 -p1
%patch2
%patch3 -p1
%patch4 -p1

%build
python setup.py build
make -C po
make -C gtk
make -C qt4
make -C doc
# set up the packaging backend
cp backends/packaging_rpm.py apport
cp backends/packaging_opensuse.py apport/packaging_impl.py

%install
python setup.py install --root=%{buildroot} --prefix=/usr
%find_lang %{name}
# install init script 
%__install -d -m755 %{buildroot}%{_sysconfdir}/init.d 
%__install -m755 %SOURCE1 %{buildroot}%{_sysconfdir}/init.d/apport
# install man pages
%__install -d -m755 %{buildroot}%{_mandir}/man1
%__install -m644 man/apport-{cli,unpack}.1 %{buildroot}%{_mandir}/man1
%__install -m644 man/dupdb-admin.1 %{buildroot}%{_mandir}/man1
%__install -d -m755 %{buildroot}%{_sysconfdir}/%{name}/blacklist.d
%__install -m644 doc/README.blacklist %{buildroot}%{_sysconfdir}/%{name}/blacklist.d
# cron job
%__install -d -m755 %{buildroot}%{_sysconfdir}/cron.daily
%__install -m755 debian/apport.cron.daily %{buildroot}%{_sysconfdir}/cron.daily/apport
# openSUSE crashdb files
%__install -m644 %SOURCE2 %{buildroot}%{_sysconfdir}/%{name}/crashdb.conf
%__install -m644 %SOURCE3 %{buildroot}%{_sysconfdir}/%{name}/crashdb.pem
# rm unneeded files
%__rm -f %{buildroot}%{_datadir}/%{name}/general-hooks/automatix.py
%__rm -rf %{buildroot}%{_datadir}/%{name}/testsuite/
%__rm -f %{buildroot}%{_bindir}/*_hook
%__rm -f %{buildroot}%{_bindir}/{kernel_crashdump,kernel_oops}
# We'll handle the docs in the %files section
%__rm -rf %{buildroot}%{_datadir}/doc/apport
#These apps aren't packaged at the moment
%__rm -f  %{buildroot}%{_bindir}/apport-{chroot,retrace}

%clean
%__rm -rf %{buildroot}

%preun
%stop_on_removal apport

%postun
%restart_on_update apport
%insserv_cleanup

%files -f %{name}.lang
%defattr(-,root,root)
%{_bindir}/dupdb-admin
%{_bindir}/apport-cli
%{_bindir}/apport-checkreports
%{_bindir}/apport-unpack
%doc doc/data-format.pdf doc/package-hooks.txt
%doc %{_mandir}/man1/apport-cli.1*
%doc %{_mandir}/man1/apport-unpack.1*
%doc %{_mandir}/man1/dupdb-admin.1*
%dir %{_sysconfdir}/apport
%dir %{_sysconfdir}/%{name}/blacklist.d
%doc %{_sysconfdir}/%{name}/blacklist.d/README.blacklist
%{_sysconfdir}/cron.daily/apport
%{_sysconfdir}/init.d/apport
# data files
%dir %{_datadir}/apport
%dir %{_datadir}/%{name}/general-hooks
%dir %{_datadir}/%{name}/package-hooks
%{_datadir}/%{name}/apport
%{_datadir}/%{name}/package-hooks/source_apport.py
%{_datadir}/%{name}/package-hooks/source_linux.py
%{_datadir}/icons/*
%{_datadir}/mime/packages/apport.xml
# python modules
%dir %python_sitelib/apport
%python_sitelib/%{name}/*.py*
%python_sitelib/problem_report.py*
%python_sitelib/apport_python_hook.py*
%python_sitelib/*egg-info

%files crashdb-opensuse
%defattr(-,root,root)
%config %{_sysconfdir}/%{name}/crashdb.conf
%config %{_sysconfdir}/%{name}/crashdb.pem
%doc doc/crashdb-conf.txt
%dir %python_sitelib/%{name}/crashdb_impl
%python_sitelib/%{name}/crashdb_impl/*

%files gtk
%defattr(-,root,root)
%{_bindir}/apport-gtk
%{_datadir}/%{name}/apport-gtk.glade

%files qt
%defattr(-,root,root)
%{_bindir}/apport-qt
%{_datadir}/%{name}/*.ui

%changelog