File backintime.spec of Package backintime

#
# spec file for package backintime
#
# Copyright (c) 2017 SUSE LINUX 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/
#


Name:           backintime
Version:        1.1.24
Release:        0
Summary:        Back In Time is a simple backup tool for Linux, inspired by "flyback project"
License:        GPL-2.0+
Group:          Productivity/Archiving/Backup
Url:            https://github.com/bit-team/backintime
Source:         https://github.com/bit-team/backintime/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1:        %{name}.png
# PATCH-FEATURE-OPENSUSE %%{name}-ssh-agent_only_if_password.patch -- kdupke@suse.com
Patch0:         %{name}-ssh-agent_only_if_password.patch
# PATCH-FEATURE-OPENSUSE %%{name}-polkit_priv_downgrade.patch boo#1007723
Patch1:         %{name}-polkit_priv_downgrade.patch
# PATCH-FIX-UPSTREAM %%{name}-security_hardening_backport.patch boo#1007723
Patch2:         %{name}-security_hardening_backport.patch
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python3-devel
BuildRequires:  update-desktop-files
Requires:       cron
Requires:       dbus-1-python3
Requires:       openssh
Requires:       python3
#Not yet available in openSUSE
#Requires:       python3-keyring
Requires:       rsync
Recommends:     encfs
Recommends:     sshfs
Conflicts:      backintime-gnome
Conflicts:      backintime-kde
Obsoletes:      backintime-doc < %{version}
Provides:       backintime-doc = %{version}-%{release}
BuildArch:      noarch

%description
Back In Time is a simple backup tool for Linux, inspired by "flyback project".

It provides a command line client 'backintime' and a Qt4 GUI 'backintime-qt4'
both written in Python3.

You only need to specify 3 things:
    * where to save snapshots;
    * what folders to backup; and
    * backup frequency (manual, every hour, every day, every month).

%package qt4
Summary:        Back In Time Qt4 GUI
Group:          Productivity/Archiving/Backup
Requires:       %{name} = %{version}
Requires:       dbus-1-python3
Requires:       libnotify-tools
Requires:       polkit
Requires:       python3-qt4

%description qt4
This package has a Qt4 GUI for %{name}.

%lang_package

%prep
%setup -q
%patch0 -p1
%patch1
%patch2

%build

# Fix documentation directories.
sed -i -e "s|'doc'|'doc/packages'|g" common/config.py
sed -i -e "s|'backintime-common'|'backintime'|g" common/config.py
sed -i -e "s|/share/doc/|/share/doc/packages/|g" common/configure qt4/configure
sed -i -e "s|backintime-common|backintime|g" common/configure qt4/configure

# Fix icon name.
sed -i 's/Icon=document-save/Icon=backintime/g' qt4/backintime-qt4.desktop
sed -i 's/Icon=document-save/Icon=backintime/g' qt4/backintime-qt4-root.desktop

pushd common
./configure --python3
make %{?_smp_mflags}
popd
pushd  qt4
./configure --python3
make %{?_smp_mflags}
popd

%install
pushd common
%make_install
popd
pushd qt4
%make_install
popd

# Remove unmaintained documentation.
rm -r %{buildroot}%{_docdir}/qt

install -D -m 644 %{SOURCE1} %{buildroot}/%{_datadir}/pixmaps/%{name}.png

# Fix duplicated files.
%fdupes %{buildroot}%{_datadir}/icons/hicolor/

# Fix executable permissions.
chmod a+x %{buildroot}%{_datadir}/%{name}/common/askpass.py
chmod a+x %{buildroot}%{_datadir}/%{name}/common/bcolors.py
chmod a+x %{buildroot}%{_datadir}/%{name}/common/create-manpage-backintime-config.py
chmod a+x %{buildroot}%{_datadir}/%{name}/common/sshMaxArg.py

%suse_update_desktop_file %{name}-qt4 System Backup
%suse_update_desktop_file %{name}-qt4-root System Backup

%find_lang %{name} --without-kde --without-gnome

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun
rm -f %{_sysconfdir}/udev/rules.d/99-backintime-*.rules

%files
%defattr(-,root,root)
%{_bindir}/%{name}
%{_bindir}/%{name}-askpass
%{_datadir}/%{name}/
%{_datadir}/icons/hicolor/*/actions/show-hidden.svg
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/bash-completion
%{_docdir}/%{name}/
%{_mandir}/man1/%{name}-askpass.1%{ext_man}
%{_mandir}/man1/%{name}-config.1%{ext_man}
%{_mandir}/man1/%{name}.1%{ext_man}
%{_sysconfdir}/xdg/autostart/backintime.desktop
%exclude %{_docdir}/%{name}-*/
%exclude %{_datadir}/%{name}/qt4
%exclude %{_datadir}/%{name}/plugins

%files lang -f %{name}.lang
%defattr(-,root,root)
%if 0%{?suse_version} < 1120
%lang(jv) %dir %{_datadir}/locale/jv
%lang(jv) %dir %{_datadir}/locale/jv/LC_MESSAGES
%endif

%files qt4
%defattr(-,root,root)
%{_bindir}/%{name}-qt4
%{_bindir}/%{name}-qt4_polkit
%{_datadir}/applications/%{name}-qt4.desktop
%{_datadir}/applications/%{name}-qt4-root.desktop
%{_datadir}/%{name}/qt4
%{_datadir}/%{name}/plugins
%dir %{_datadir}/dbus-1
%dir %{_datadir}/dbus-1/system-services
%{_datadir}/dbus-1/system-services/net.launchpad.backintime.serviceHelper.service
%dir %{_datadir}/polkit-1
%dir %{_datadir}/polkit-1/actions
%{_datadir}/polkit-1/actions/net.launchpad.backintime.policy
%{_docdir}/%{name}-qt4/
%{_mandir}/man1/%{name}-qt4.1%{ext_man}
%dir %{_sysconfdir}/dbus-1
%dir %{_sysconfdir}/dbus-1/system.d
%config %{_sysconfdir}/dbus-1/system.d/net.launchpad.backintime.serviceHelper.conf

%changelog