File trippy.spec of Package trippy

#
# spec file for package trip
#
# Copyright (c) 2026 SUSE LLC and contributors
#
# 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/
#

%define appname trip
Name:           trippy
Version:        0.13.0
Release:        0
Summary:        A network diagnostic tool
License:        Apache-2.0
Group:          Productivity/Networking/Diagnostic
URL:            https://github.com/fujiapple852/trippy
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
BuildRequires:  cargo-packaging

%description
Trippy combines the functionality of traceroute and ping and is designed to assist with the analysis of networking issues.

%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
%setup -q
%setup -q -T -D -a 1

%build
%{cargo_build}

for shell in "zsh" "bash" "fish"
do
  target/release/%{appname} --generate "$shell" > target/%{appname}."$shell"
done

target/release/%{appname} --generate-man > target/%{appname}.1

%install
mkdir -p "%{buildroot}/%{_mandir}/man1/"
install -Dm 0755 "target/release/%{appname}" "%{buildroot}/%{_bindir}/%{appname}"
install -Dm 0644 "target/%{appname}.bash"    "%{buildroot}/%{_datadir}/bash-completion/completions/%{name}"
install -Dm 0644 "target/%{appname}.fish"    "%{buildroot}/%{_datadir}/fish/vendor_completions.d/%{name}.fish"
install -Dm 0644 "target/%{appname}.zsh"     "%{buildroot}/%{_datadir}/zsh/site-functions/_%{name}"
install -Dm 0644 "target/%{appname}.1"       "%{buildroot}/%{_mandir}/man1/"

#%%check
#%%cargo_test -- --skip XXX

%files
%license LICENSE
%doc README.md trippy-config-sample.toml
%{_bindir}/%{appname}
%{_mandir}/man1/%{appname}.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}

%pre

%post

%preun

%postun

%changelog
openSUSE Build Service is sponsored by