File qSnapper.spec of Package qSnapper

#
# spec file for package qSnapper
#
# Copyright (c) 2026 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 https://bugs.opensuse.org/
#

%global selinuxtype targeted
Name:           qSnapper
Version:        1.0.3
Release:        0
Summary:        Snapper snapshot manager
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License:        GPL-3.0-or-later 
Group:		System/Packages
URL:            https://github.com/presire/qSnapper.git
Source:         %{name}-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  qt6-base-devel
BuildRequires:  qt6-declarative-devel
BuildRequires:  qt6-quickcontrols2-devel
BuildRequires:  qt6-linguist-devel
BuildRequires:  polkit-devel
BuildRequires:  libpolkit-qt6-1-devel
BuildRequires:  libsnapper-devel
BuildRequires:  selinux-policy-devel
BuildRequires:  policycoreutils
BuildRequires:  selinux-policy-targeted

%description
A modern Qt6/QML GUI application for managing Btrfs/Snapper filesystem snapshots on Linux.

%package selinux
Summary:     SELinux module for qSnapper
Requires:    %{name} == %{version}
BuildArch:   noarch
%{selinux_requires}

%description selinux
This package provides the SELinux policy module to ensure qSnapper 
runs properly under an environment with SELinux enabled.

%package lang
Summary:     Translations for qSnapper
Requires:    %{name} == %{version}
BuildArch:   noarch

%description lang
Provides translations for the qSnapper package.

%prep
%autosetup -p1 

%build
CMAKE_OPTS="-DENABLE_SELINUX=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_SKIP_INSTALL_RPATH=TRUE"
%cmake $CMAKE_OPTS 
%cmake_build

%install
%cmake_install
install -d %{buildroot}%{_datadir}/qsnapper/translations/
install %{_builddir}/%{name}-%{version}/build/qsnapper_*.qm %{buildroot}%{_datadir}/qsnapper/translations/

%pre selinux
%{selinux_relabel_pre -s %{selinuxtype}}

%post selinux
%{selinux_modules_install -s %{selinuxtype} -p 200 %{_datadir}/selinux/packages/qsnapper.pp}

%postun selinux
if [ $1 -eq 0 ]; then
    %{selinux_modules_uninstall -s %{selinuxtype} -p 200 qsnapper}
fi


%posttrans selinux
%{selinux_relabel_post -s %{selinuxtype}}

%files
%license LICENSE.md
%doc README.md
%{_bindir}/qsnapper
%{_libexecdir}/qsnapper-dbus-service
%{_datadir}/applications/qsnapper.desktop
%{_datadir}/dbus-1/system-services/com.presire.qsnapper.Operations.service
%{_datadir}/dbus-1/system.d/com.presire.qsnapper.Operations.conf
%{_datadir}/icons/hicolor/128x128/apps/qSnapper.png
%{_datadir}/polkit-1/actions/com.presire.qsnapper.policy

%files selinux
%{_datadir}/selinux/packages/qsnapper.pp
%dir %{_datadir}/doc/packages/qSnapper/selinux
%{_datadir}/doc/packages/qSnapper/selinux/ADMIN.md
%{_datadir}/doc/packages/qSnapper/selinux/README.md
%{_datadir}/doc/packages/qSnapper/selinux/qsnapper.fc
%{_datadir}/doc/packages/qSnapper/selinux/qsnapper.fc.in
%{_datadir}/doc/packages/qSnapper/selinux/qsnapper.if
%{_datadir}/doc/packages/qSnapper/selinux/qsnapper.te

%files lang
%dir %{_datadir}/qsnapper
%dir %{_datadir}/qsnapper/translations
%{_datadir}/qsnapper/translations/qsnapper_*.qm

%changelog

openSUSE Build Service is sponsored by