File sniffnet.spec of Package sniffnet

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


%bcond_with test
Name:           sniffnet
Version:        1.3.2
Release:        0
Summary:        Application to monitor Internet traffic
License:        Apache-2.0 AND MIT
URL:            https://github.com/GyulyVGC/sniffnet
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
Source2:        howtorun.md
BuildRequires:  desktop-file-utils
BuildRequires:  extra-cmake-modules
BuildRequires:  cargo-packaging
BuildRequires:  rust >= 1.70
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(libpcap)
Recommends:     libcap-progs
ExclusiveArch:  x86_64 aarch64

%description
Sniffnet is a network monitoring tool to help you keep track of your
Internet traffic.

%prep
%autosetup -a1

cat %{SOURCE2} >> README.md

%build
%{cargo_build}

%install
install -Dm755 target/release/%{name} -t %{buildroot}%{_bindir}
resources="resources/packaging/linux"
desktop-file-install --dir \
    %{buildroot}%{_datadir}/applications $resources/sniffnet.desktop
for icon in $resources/graphics/*; do
    resolution=$(basename $icon | grep -Eo "[[:digit:]]+x[[:digit:]]+")
    install -pDm644 "$icon" \
        %{buildroot}%{_datadir}/icons/hicolor/$resolution/apps/%{name}.png
done

%check
%if %{with test}
%{cargo_test} -- \
    --skip=secondary_threads::check_updates::tests::fetch_latest_release_from_github
%endif
desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop

%files
%license LICENSE-APACHE LICENSE-MIT
%doc README.md ROADMAP.md SECURITY.md
%{_bindir}/%{name}
%{_datadir}/icons/hicolor
%{_datadir}/applications/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by