File asciinema.spec of Package asciinema

#
# spec file for package asciinema
#
# 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_without check
Name:           asciinema
Version:        3.1.0
Release:        0
Summary:        Terminal session recorder
License:        GPL-3.0-or-later
Group:          Productivity/Networking/Other
URL:            https://github.com/asciinema/asciinema
Source0:        %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.zst
BuildRequires:  cargo >= 1.81.0
BuildRequires:  cargo-packaging
ExclusiveArch:  %{rust_arches}

%description
asciinema (aka asciinema CLI or asciinema recorder) is a command-line tool
for recording terminal sessions.

%package        bash-completion
Summary:        Bash completion for %{name}
Group:          System/Shells
Requires:       bash-completion
Supplements:    (%{name} and bash)
BuildArch:      noarch

%description    bash-completion
Bash command line completion support for %{name}.

%package        fish-completion
Summary:        Fish Completion for %{name}
Group:          System/Shells
Requires:       fish
Supplements:    (%{name} and fish)
BuildArch:      noarch

%description    fish-completion
Fish command line completion support for %{name}.

%package        zsh-completion
Summary:        Zsh Completion for %{name}
Group:          System/Shells
Requires:       zsh
Supplements:    (%{name} and zsh)
BuildArch:      noarch

%description    zsh-completion
ZSH command line completion support for %{name}.

%prep
%autosetup -p1 -a1

%build
export ASCIINEMA_GEN_DIR="%{_builddir}/%{name}-%{version}"
%{cargo_build}

%install
%{cargo_install}
install -Dm 0644 man/%{name}*.1 -t %{buildroot}%{_mandir}/man1/
install -Dm 0644 completion/%{name}.bash %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -Dm 0644 completion/%{name}.fish -t %{buildroot}%{_datadir}/fish/vendor_completions.d/
install -Dm 0644 completion/_%{name} -t %{buildroot}%{_datadir}/zsh/site-functions/

%if %{with check}
%check
%{cargo_test} -- \
    --skip=pty::tests::spawn_basic
%endif

%files
%doc CHANGELOG.md CONTRIBUTING.md README.md
%{_bindir}/%{name}
%{_mandir}/man?/%{name}*.?%{?ext_man}
%license LICENSE

%files bash-completion
%dir %{_datadir}/bash-completion/
%dir %{_datadir}/bash-completion/completions
%{_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
openSUSE Build Service is sponsored by