rust-sequoia-sqv/rust-sequoia-sqv.spec
Jakub Jelen ca2cf7466f Make installation of shell completions and man pages more robust
Without this, OpenScanHub fails to run the install step as it injects
clippy build into the process, which creates different configuration and
therefore different build directory.

Taken from Fedora change

790309acb1

Related: RHEL-84164
2025-03-27 15:51:21 +01:00

136 lines
3.6 KiB
RPMSpec

# Generated by rust2rpm 27
%bcond check 1
%global crate sequoia-sqv
%if 0%{?rhel}
# RHEL: Use bundled deps as it doesn't ship Rust libraries
%global bundled_rust_deps 1
%global __brp_mangle_shebangs_exclude_from ^/usr/src/debug/.*$
%else
# Fedora: Use only system Rust libraries
%global bundled_rust_deps 0
%endif
Name: rust-sequoia-sqv
Version: 1.3.0
Release: %autorelease
Summary: Simple OpenPGP signature verification program
License: LGPL-2.0-or-later
URL: https://crates.io/crates/sequoia-sqv
Source: %{crates_source}
# Generated using cargo-vendor-filterer:
# cargo download %%{crate}==%%{version} > %%{crate}-%%{version}.crate
# tar xf %%{crate}-%%{version}.crate
# pushd %%{crate}-%%{version}
# cargo vendor-filterer --platform x86_64-unknown-linux-gnu \
# --platform powerpc64le-unknown-linux-gnu \
# --platform aarch64-unknown-linux-gnu \
# --platform i686-unknown-linux-gnu \
# --platform s390x-unknown-linux-gnu \
# --all-features
# tar -cJf ../rust-%%{crate}-%%{version}-vendor.tar.xz vendor
# popd
Source1: %{name}-%{version}-vendor.tar.xz
# Manually created patch for downstream crate metadata changes
# * switch crypto backend from Nettle to OpenSSL
# * exclude files that are only useful for upstream development
# * drop features for unsupported crypto backends
Patch: sequoia-sqv-fix-metadata.diff
ExclusiveArch: %{rust_arches}
%if 0%{?bundled_rust_deps}
BuildRequires: rust-toolset
# vendored openssl-sys
BuildRequires: openssl-devel
%else
BuildRequires: cargo-rpm-macros >= 24
%endif
%global _description %{expand:
A simple OpenPGP signature verification program.}
%description %{_description}
%package -n %{crate}
Summary: %{summary}
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# Apache-2.0
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-3-Clause
# BSL-1.0
# LGPL-2.0-or-later
# MIT
# MIT OR Apache-2.0
# MIT OR Apache-2.0 OR Zlib
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License: %{shrink:
LGPL-2.0-or-later AND
Apache-2.0 AND
BSD-3-Clause AND
BSL-1.0 AND
MIT AND
Unicode-DFS-2016 AND
(Apache-2.0 OR MIT) AND
(Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND
(MIT OR Apache-2.0 OR Zlib) AND
(Unlicense OR MIT)
}
# LICENSE.dependencies contains a full license breakdown
%description -n %{crate} %{_description}
%files -n %{crate}
%license LICENSE.txt
%license LICENSE.dependencies
%doc README.md
%{_bindir}/sqv
%{_mandir}/man1/sqv*
%{bash_completions_dir}/sqv.bash
%{fish_completions_dir}/sqv.fish
%{zsh_completions_dir}/_sqv
%prep
%autosetup -n %{crate}-%{version} -N %{?bundled_rust_deps:-a1}
%autopatch -M 99 -p1
%if 0%{?bundled_rust_deps}
%cargo_prep -v vendor
%else
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%endif
%build
export ASSET_OUT_DIR=target/assets
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
# install manual pages
mkdir -p %{buildroot}/%{_mandir}/man1
cp -pav target/assets/man-pages/sqv*.1 %{buildroot}/%{_mandir}/man1/
# install shell completions
install -Dpm 0644 target/assets/shell-completions/sqv.bash \
%{buildroot}/%{bash_completions_dir}/sqv.bash
install -Dpm 0644 target/assets/shell-completions/sqv.fish \
%{buildroot}/%{fish_completions_dir}/sqv.fish
install -Dpm 0644 target/assets/shell-completions/_sqv \
%{buildroot}/%{zsh_completions_dir}/_sqv
%if %{with check}
%check
%cargo_test
%endif
%changelog
%autochangelog