File backintime.spec of Package backintime

# spec file for package backintime
# Copyright (c) 2024 SUSE LLC
# 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

%if 0%{?suse_version} > 1500
%define pythons python3

Name:           backintime
Version:        1.4.1
Release:        0
Summary:        Backup tool for Linux inspired by the "flyback project"
Group:          Productivity/Archiving/Backup
License:        GPL-2.0-or-later
# Public key mentioned in
Source2:        %{name}.keyring
Source3:        %{name}.png
# PATCH-FEATURE-OPENSUSE %%{name}-polkit_priv_downgrade.patch boo#1007723
Patch0:         %{name}-polkit_priv_downgrade.patch
# PATCH-FEATURE-UPSTREAM %%{name}-python_location.patch
Patch1:         %{name}-python_location.patch
BuildRequires:  %{python_module devel >= 3.8}
# TEST REQUIREMENTS (only works on real hardware)
#BuildRequires:  %#{python_module packaging}
#BuildRequires:  %#{python_module dbus-python}
#BuildRequires:  %#{python_module keyring}
#BuildRequires:  %#{python_module pyfakefs}
#BuildRequires:  openssh
#BuildRequires:  rsync
#BuildRequires:  udev
BuildConflicts: python3-devel < 3.8
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python-rpm-macros
BuildRequires:  update-desktop-files
Requires:       %{python_flavor}-dbus-python
Requires:       %{python_flavor}-keyring
Requires:       %{python_flavor}-packaging
Requires:       cron
Requires:       openssh
Requires:       pkexec
Requires:       python3 >= 3.8
Requires:       rsync
Recommends:     encfs
Recommends:     sshfs
Requires:       libnotify-tools
Conflicts:      backintime-gnome
Conflicts:      backintime-kde
Obsoletes:      backintime-doc < %{version}
Provides:       backintime-doc = %{version}-%{release}
BuildArch:      noarch

Back In Time is a backup tool for Linux inspired by the "flyback project".

It provides a command line client 'backintime' and a Qt5 GUI 'backintime-qt'
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 qt
Summary:        Back In Time Qt5 GUI
Requires:       %{name} = %{version}
Requires:       %{python_flavor}-dbus-python
Requires:       %{python_flavor}-qt5
Requires:       libqt5-qttranslations
Requires:       polkit
# used as a fallback in case of missing icons
Recommends:     oxygen5-icon-theme
Obsoletes:      backintime-qt4 < %{version}
Provides:       backintime-qt4 = %{version}-%{release}

%description qt
This package has a Qt5 GUI for %{name}.


%setup -q
%patch -P 0
%patch -P 1 -p1


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

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

# Fix shebangs
%python_expand sed -i "s|/usr/bin/env python|#!/usr/bin/$python|g" common/

pushd common
%python_expand ./configure --python="%{_bindir}/$python"
make %{?_smp_mflags}
pushd qt
%python_expand ./configure --python="%{_bindir}/$python"
make %{?_smp_mflags}

pushd common
pushd qt

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

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

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

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

#%#check  # Only works on real hardware
#pushd common
#make test

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

%config %{_sysconfdir}/xdg/autostart/backintime.desktop
%exclude %{_docdir}/%{name}-*/
%exclude %{_datadir}/%{name}/qt
%exclude %{_datadir}/%{name}/plugins

%files lang -f %{name}.lang

%files qt
%dir %{_datadir}/dbus-1
%dir %{_datadir}/dbus-1/system-services
%dir %{_datadir}/polkit-1
%dir %{_datadir}/polkit-1/actions
%dir %{_sysconfdir}/dbus-1
%dir %{_sysconfdir}/dbus-1/system.d
%config %{_sysconfdir}/dbus-1/system.d/net.launchpad.backintime.serviceHelper.conf

openSUSE Build Service is sponsored by