rust-sequoia-sq/rust-sequoia-sq.spec
Daiki Ueno 2dc75042e8 Don't compile capnproto in %prep
Related: RHEL-45863
Signed-off-by: Daiki Ueno <dueno@redhat.com>
2024-08-20 20:32:55 +09:00

159 lines
5.2 KiB
RPMSpec

# Generated by rust2rpm 26
%bcond_without check
%global crate sequoia-sq
%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/.*$
%bcond_without bundled_capnproto
%else
# Fedora: Use only system Rust libraries
%global bundled_rust_deps 0
%bcond_with bundled_capnproto
%endif
Name: rust-sequoia-sq
Version: 0.37.0
Release: %autorelease
Summary: Command-line frontends for Sequoia
License: LGPL-2.0-or-later
URL: https://crates.io/crates/sequoia-sq
Source0: %{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=true
Source1: %{name}-%{version}-vendor.tar.xz
Source2: capnproto-c++-1.0.1.tar.gz
# 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
%if 0%{?bundled_rust_deps}
BuildRequires: rust-toolset
# vendored openssl-sys
BuildRequires: openssl-devel
# vendored rustqlite
BuildRequires: sqlite-devel
%else
BuildRequires: cargo-rpm-macros >= 24
%endif
%if %{with bundled_capnproto}
BuildRequires: gcc-c++
BuildRequires: cmake >= 3.1
%endif
%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
# 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: 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 (BSD-2-Clause 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}/sq
%{_mandir}/man1/sq*
%{bash_completions_dir}/sq.bash
%{fish_completions_dir}/sq.fish
%{zsh_completions_dir}/_sq
%prep
%autosetup -n %{crate}-%{version} -N %{?bundled_rust_deps:-a1}
%autopatch -M 99 -p1
%if 0%{?bundled_rust_deps}
%cargo_prep -v vendor
# drop broken integration tests
rm -vr subplot/
%else
%cargo_prep
# drop broken integration tests
rm -vr subplot/
%generate_buildrequires
%cargo_generate_buildrequires
%endif
%if %{with bundled_capnproto}
mkdir -p bundled_capnproto
pushd bundled_capnproto
tar --strip-components=1 -xf %{SOURCE2}
popd
%endif
%build
%if %{with bundled_capnproto}
pushd bundled_capnproto
%cmake -DBUILD_TESTING=OFF
%cmake_build
export PATH="$PWD/%{__cmake_builddir}/src/capnp:$PATH"
popd
%endif
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%install
%cargo_install
# install manual pages
mkdir -p %{buildroot}/%{_mandir}/man1
cp -pav target/release/build/%{crate}-*/out/man-pages/sq*.1 %{buildroot}/%{_mandir}/man1/
# install shell completions
install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sq.bash \
%{buildroot}/%{bash_completions_dir}/sq.bash
install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/sq.fish \
%{buildroot}/%{fish_completions_dir}/sq.fish
install -Dpm 0644 target/release/build/%{crate}-*/out/shell-completions/_sq \
%{buildroot}/%{zsh_completions_dir}/_sq
%if %{with check}
%check
# * skip tests that require files which are not included in published crates
# * skip tests that fail because the Fedora crypto policy is too strict
%cargo_test -- -- --exact --skip cli::cert::export::sq_cert_export --skip cli::cert::import::sq_cert_import --skip cli::inspect::sq_inspect --skip cli::key::expire::sq_key_expire --skip cli::key::sq_key_import --skip cli::key::sq_key_list --skip cli::pki::sq_pki_authenticate --skip cli::pki::sq_pki_identify --skip cli::pki::sq_pki_list --skip cli::pki::sq_pki_lookup --skip cli::pki::sq_pki_path --skip sq_sign --skip sq_sign_append --skip sq_sign_append_on_compress_then_sign --skip sq_sign_detached --skip sq_sign_detached_append --skip sq_sign_with_notations --skip sq_autocrypt_import
%endif
%changelog
%autochangelog