rust-sequoia-sq/rust-sequoia-sq.spec

170 lines
4.7 KiB
RPMSpec

# Generated by rust2rpm 27
%bcond check 1
%global crate sequoia-sq
%if 0%{?rhel}
%global __brp_mangle_shebangs_exclude_from ^/usr/src/debug/.*$
%endif
Name: rust-sequoia-sq
Version: 1.4.0.2
Release: %autorelease
Summary: Command-line frontends for Sequoia
License: LGPL-2.0-or-later
URL: https://crates.io/crates/sequoia-sq
# Upstream version 1.4.0 adjusted to 1.4.0.2 to fix sorting due to
# previously using manually created tarball with verison 1.4.0.1
# based on the pre-release upstream version 1.4.0
Source0: %{crates_source}
# Generated using cargo-vendor-filterer:
# cargo download %%{crate}==1.4.0 > %%{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 -czf ../%%{crate}-vendor-%%{version}.tar.gz vendor
Source1: %{crate}-vendor-%{version}.tar.gz
Source3: vendor.toml
# 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 automated generation of upstream integration tests
# * drop features for unsupported crypto backends
Patch: sequoia-sq-fix-metadata.diff
# Backward comatibility for algorithm names from pre-release snapshot
Patch1: rust-sequoia-sq-mldsa-alias.patch
# b8498a61d397bee6dc5574d44041a263a5a5c0ad
# 7f929fc58f9ec97f409a165904fc606b579ee49c
Patch2: sequoia-sq-decrypt-password.patch
%if 0%{?rhel}
BuildRequires: rust-toolset
%else
BuildRequires: cargo-rpm-macros >= 24
%endif
# vendored openssl-sys
BuildRequires: openssl-devel
# vendored rustqlite
BuildRequires: sqlite-devel
# vendored capnp needs both cli and development libraries
BuildRequires: capnproto
BuildRequires: capnproto-devel
BuildRequires: clang
%global _description %{expand:
Command-line frontends for Sequoia.}
%description %{_description}
%package -n %{crate}
Summary: %{summary}
# (Apache-2.0 OR MIT) AND BSD-3-Clause
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# 0BSD OR MIT OR Apache-2.0
# Apache-2.0
# Apache-2.0 AND MIT
# Apache-2.0 OR BSL-1.0
# Apache-2.0 OR ISC OR MIT
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-2-Clause 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
# MIT OR Zlib OR Apache-2.0
# MPL-2.0
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License: %{shrink:
LGPL-2.0-or-later AND
Apache-2.0 AND
BSL-1.0 AND
BSD-3-Clause AND
MIT AND
MPL-2.0 AND
Unicode-DFS-2016 AND
(0BSD OR MIT OR Apache-2.0) AND
(Apache-2.0 OR BSL-1.0) AND
(Apache-2.0 OR ISC OR MIT) 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
%license cargo-vendor.txt
%doc README.md
%{_bindir}/sq
%{_mandir}/man1/sq*
%if 0%{?rhel} > 9
%{bash_completions_dir}/sq.bash
%{fish_completions_dir}/sq.fish
%{zsh_completions_dir}/_sq
%endif
%prep
%autosetup -n %{crate}-1.4.0 -a1 -p1
%cargo_prep -N
# include full configuration for vendored dependencies
cat %{SOURCE3} >> .cargo/config.toml
# drop broken integration tests
rm -vr subplot/
rm -v tests/sq-subplot.rs
%build
export ASSET_OUT_DIR=target/assets
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%{cargo_vendor_manifest}
# replace un-parseable git snapshot dependency information
sed 's/\(.*\) (.*#\(.*\))/\1+git\2/' -i cargo-vendor.txt
%install
# for some reason, cargo install does not work
# with vendored dependncies from git branch
#%%cargo_install
install -Dpm 0755 target/rpm/sq -t %{buildroot}/%{_bindir}
# install manual pages
mkdir -p %{buildroot}/%{_mandir}/man1
cp -pav target/assets/man-pages/sq*.1 %{buildroot}/%{_mandir}/man1/
%if 0%{?rhel} > 9
# install shell completions
install -Dpm 0644 target/assets/shell-completions/sq.bash \
%{buildroot}/%{bash_completions_dir}/sq.bash
install -Dpm 0644 target/assets/shell-completions/sq.fish \
%{buildroot}/%{fish_completions_dir}/sq.fish
install -Dpm 0644 target/assets/shell-completions/_sq \
%{buildroot}/%{zsh_completions_dir}/_sq
%endif
%if %{with check}
%check
%cargo_test
%endif
%changelog
%autochangelog