%global snapdate 20180123
%global snaphash df1ae0e5de1c83d99ec959cf5cc49ca870d0b2bc

Name:           nomad-firewall
Version:        0.1
Release:        2.%{snapdate}git%(echo %{snaphash} | cut -c -13)%{?dist}
Summary:        UFW control module for KDE Plasma 5 and Nomad Desktop

# Some files GPLv3 only, some files GPLv2+
License:        GPLv3
URL:            https://github.com/nomad-desktop/nomad-firewall
Source0:        https://github.com/nomad-desktop/nomad-firewall/archive/%{snaphash}/%{name}-%{snaphash}.tar.gz

BuildRequires:  cmake
BuildRequires:  extra-cmake-modules
BuildRequires:  gcc-c++
# for netstat (path detected at build time)
BuildRequires:  net-tools
BuildRequires:  qt5-qtbase-devel
BuildRequires:  qt5-qtdeclarative-devel
BuildRequires:  qt5-qtx11extras-devel
BuildRequires:  kf5-rpm-macros
BuildRequires:  kf5-kcoreaddons-devel
BuildRequires:  kf5-kcmutils-devel
BuildRequires:  kf5-ki18n-devel
BuildRequires:  kf5-plasma-devel
BuildRequires:  kf5-kdelibs4support-devel
BuildRequires:  kf5-kdeclarative-devel
BuildRequires:  kf5-kauth-devel
BuildRequires:  kf5-kconfig-devel
BuildRequires:  python3-devel
# bytecompile with Python 3
%global __python %{__python3}

Requires:       python3
Requires:       ufw
# for netstat
Requires:       net-tools

%description
KDE Plasma 5 KControl Module to configure and control the Uncomplicated Firewall
(UFW), by the Nomad Desktop project (a desktop environment based on Plasma 5
technologies).

%prep
%setup -q -n %{name}-%{snaphash}

%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
%{cmake_kf5} ../
popd
make %{?_smp_mflags} -C %{_target_platform}

%install
make install/fast DESTDIR=%{buildroot} -C %{_target_platform}

%files
%license LICENSE
%{_kf5_sysconfdir}/dbus-1/system.d/org.nomad.ufw.conf
%{_kf5_sysconfdir}/dbus-1/system.d/org.nxos.netstat.conf
%{_kf5_qtplugindir}/kcms/org.nxos.firewall.so
%{_kf5_qmldir}/org/nomad/
%{_kf5_libexecdir}/kauth/nomad_ufw_plugin_helper
%{_kf5_libexecdir}/kauth/nxos_netstat_helper
%{_libexecdir}/nomad_ufw_plugin_helper.py
%{_libexecdir}/__pycache__/
%{_kf5_datadir}/dbus-1/system-services/org.nomad.ufw.service
%{_kf5_datadir}/dbus-1/system-services/org.nxos.netstat.service
# ufw-kde used _kde4_appsdir = _kf5_datadir/apps, so this does not conflict
%{_kf5_datadir}/kcm_ufw/
%if 0%{?fedora} && 0%{?fedora} < 28
# This should probably be owned by something else (#1536892)
%dir %{_kf5_datadir}/kpackage/kcms
%endif
%{_kf5_datadir}/kpackage/kcms/org.nxos.firewall/
%{_kf5_datadir}/kservices5/org_nxos_firewall.desktop
%{_kf5_datadir}/polkit-1/actions/org.nomad.ufw.policy
%{_kf5_datadir}/polkit-1/actions/org.nxos.netstat.policy
%{_kf5_metainfodir}/org.nxos.firewall.appdata.xml

%changelog
* Tue Jan 23 2018 Kevin Kofler <Kevin@tigcc.ticalc.org> - 0.1-2.20180123gitdf1ae0e5de1c8
- New snapshot (git master commit df1ae0e5de1c83d99ec959cf5cc49ca870d0b2bc)
- Patches upstreamed, drop them
- Don't own %%{_kf5_datadir}/kpackage/kcms on F28+, #1536892 fixed there

* Sun Jan 21 2018 Kevin Kofler <Kevin@tigcc.ticalc.org> - 0.1-1.20170801gite46458f7d0dc2
- Initial package