File somo.spec of Package somo
#
# spec file for package somo
#
# Copyright (c) 2025 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/
#
Name: somo
Version: 1.3.1
Release: 0
Summary: A human-friendly alternative to netstat for socket and port monitoring
License: MIT
URL: https://github.com/theopfr/somo
Source0: %{name}-%{version}.tar.zst
Source1: vendor.tar.zst
BuildRequires: cargo-packaging
BuildRequires: zstd
BuildRequires: help2man
BuildRequires: pigz
%description
A human-friendly alternative to netstat for socket and port monitoring.
%package bash-completion
Summary: Bash completion for %{name}
Requires: %{name} = %{version}
Supplements: (%{name} and bash-completion)
BuildArch: noarch
%description bash-completion
Bash command line completion support for %{name}.
%package fish-completion
Summary: Fish completion for %{name}
Requires: %{name} = %{version}
Supplements: (%{name} and fish)
BuildArch: noarch
%description fish-completion
Fish command line completion support for %{name}.
%package zsh-completion
Summary: Zsh completion for %{name}
Requires: %{name} = %{version}
Supplements: (%{name} and zsh)
BuildArch: noarch
%description zsh-completion
Zsh command line completion support for %{name}.
%prep
%autosetup -a1 -p1
%build
%{cargo_build}
for shell in "zsh" "bash" "fish"
do
./target/release/%{name} generate-completions "$shell" > target/%{name}."$shell"
done
help2man -N -n "Socket and port monitoring tool" target/release/%{name} > target/%{name}.1
#%%check
#%%{cargo_check}
%install
mkdir -p "%{buildroot}%{_mandir}/man1/"
install -Dm 0755 "target/release/%{name}" "%{buildroot}%{_bindir}/%{name}"
install -Dm 0644 "target/%{name}.bash" "%{buildroot}/%{_datadir}/bash-completion/completions/%{name}"
install -Dm 0644 "target/%{name}.fish" "%{buildroot}/%{_datadir}/fish/vendor_completions.d/%{name}.fish"
install -Dm 0644 "target/%{name}.zsh" "%{buildroot}/%{_datadir}/zsh/site-functions/_%{name}"
install -Dm 0644 "target/%{name}.1" "%{buildroot}%{_mandir}/man1/"
%files
%license LICENSE
%doc README.md images/*
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1%{ext_man}
%files bash-completion
%{_datadir}/bash-completion/completions/%{name}
%files fish-completion
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/%{name}.fish
%files zsh-completion
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_%{name}
%changelog