File flawz.spec of Package flawz

#
# spec file for package flawz
#
# 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:           flawz
Version:        0.3.0
Release:        0
Summary:        Terminal User Interface (TUI) for browsing the security vulnerabilities
License:        MIT or Apache-2.0
URL:            https://github.com/orhun/flawz
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
BuildRequires:  cargo-packaging
BuildRequires:  libopenssl-devel
BuildRequires:  gcc
BuildRequires:  sqlite3-devel

%description
Terminal User Interface (TUI) for browsing the security vulnerabilities (also known as CVEs).

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

%description bash-completion
The official bash completion script for %{name}, generated during the build.

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

%description zsh-completion
The official zsh completion script for %{name}, generated during the build.

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

%description fish-completion
The official fish completion script for %{name}, generated during the build.

%prep
%autosetup -a 1

%build
%{cargo_build}

%install
# Install the binary.
install -Dm 755 target/release/%{name} %{buildroot}%{_bindir}/%{name}
# Build the shell autocomplete files & the man pages
mkdir -p generated
export OUT_DIR="generated"
target/release/%{name}-completions
target/release/%{name}-mangen
# Install the shell autocomplete files
install -Dm 644 generated/%{name}.bash %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -Dm 644 generated/_%{name} -t %{buildroot}%{_datadir}/zsh/site-functions/
install -Dm 644 generated/%{name}.fish -t %{buildroot}%{_datadir}/fish/vendor_completions.d
# Install the the man pages
install -Dm 644 generated/%{name}.1 -t %{buildroot}%{_mandir}/man1

%check
# execute the binary as a basic check
%{buildroot}%{_bindir}/%{name} --help

%files
%license LICENSE-APACHE LICENSE-MIT
%doc README.md SECURITY.md RELEASE.md
%{_bindir}/flawz
%dir %{_mandir}/man1
%{_mandir}/man1/%{name}.1.gz

%files bash-completion
%{_datadir}/bash-completion/completions/%{name}

%files zsh-completion
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_%{name}

%files fish-completion
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/%{name}.fish

%changelog
openSUSE Build Service is sponsored by