File cyme.spec of Package cyme

#
# spec file for package cyme
#
# 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/
#


Name:           cyme
Version:        2.2.7
Release:        0
Summary:        List system USB buses and devices
License:        GPL-3.0-or-later
URL:            https://github.com/tuna-f1sh/cyme
Source0:        %{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
BuildRequires:  cargo-packaging
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(gusb)
BuildRequires:  pkgconfig(libudev)
ExclusiveArch:  %{rust_tier1_arches}

%description
List system USB buses and devices; a lib and modern cross-platform lsusb that attempts to maintain compatibility with,
but also add new features. Includes a macOS system_profiler SPUSBDataType parser module and libusb profiler for non-macOS systems/gathering more verbose information.
The project started as a quick replacement for the barely working lsusb script and a Rust project to keep me up to date!
Like most fun projects, it quickly experienced feature creep as I developed it into a cross-platform replacement for lsusb.
As a developer of embedded devices, I use a USB list tool on a frequent basis and developed this to cater to what I believe are the short comings of lsusb:
verbose dump is too verbose, tree doesn't contain useful data on the whole,
it barely works on non-Linux platforms and modern terminals support features that make glancing through the data easier.
It's not perfect as it started out as a Rust refresher but I had a lot of fun developing it and hope others will find it useful and can contribute.
Reading around the lsusb source code, USB-IF and general USB information was also a good knowledge builder.
The name comes from the technical term for the type of blossom on a Apple tree: cyme - it is Apple related and also looks like a USB device tree 😃🌸.

%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 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}.

%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 powershell-completion
Summary:        Powershell completion for %{name}
Requires:       %{name} = %{version}
Supplements:    (%{name} and powershell)
BuildArch:      noarch

%description powershell-completion
Powershell command line completion support for %{name}.

%prep
%autosetup -a1

%build
%{cargo_build} --all-features

%install
install -Dm755 target/release/%{name} %{buildroot}%{_bindir}/%{name}
install -Dm644 doc/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1%{?ext_man}
install -Dm644 doc/%{name}.bash  %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -Dm644 doc/%{name}.fish  %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish
install -Dm644 doc/_%{name}  %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
install -Dm644 doc/_%{name}.ps1  %{buildroot}%{_datadir}/powershell/Modules/%{name}/%{name}.ps1

%files
%license LICENSE
%doc CHANGELOG.md README.md
%{_bindir}/%{name}
%{_mandir}/man1/cyme.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
%{_datadir}/zsh/site-functions/_%{name}

%files powershell-completion
%dir %{_datadir}/powershell
%dir %{_datadir}/powershell/Modules
%dir %{_datadir}/powershell/Modules/%{name}
%{_datadir}/powershell/Modules/%{name}/%{name}.ps1

%changelog
openSUSE Build Service is sponsored by