Use vendored dependencies in RHEL builds

RHEL does not provide individual Rust dependency packages.
This commit is contained in:
Yaakov Selkowitz 2023-05-15 22:31:58 -04:00
parent 8ea82a45ba
commit 997d42deeb
3 changed files with 26 additions and 2 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/rpm-sequoia-1.2.0.crate
/rpm-sequoia-1.3.0.crate
/rpm-sequoia-1.4.0.crate
/rpm-sequoia-1.4.0-vendor.tar.xz

View File

@ -1,6 +1,13 @@
# Generated by rust2rpm 24
%bcond_without check
# RHEL does not have packages for Rust dependencies
%if 0%{?rhel}
%global bundled_rust_deps 1
%else
%global bundled_rust_deps 0
%endif
%global crate rpm-sequoia
Name: rust-rpm-sequoia
@ -11,11 +18,22 @@ Summary: Implementation of the RPM PGP interface using Sequoia
License: LGPL-2.0-or-later
URL: https://crates.io/crates/rpm-sequoia
Source: %{crates_source}
# To create the vendor tarball:
# tar xf %%{crate}-%%{version}.crate ; pushd %%{crate}-%%{version} ; \
# patch -p1 < ../rpm-sequoia-fix-metadata.diff ; \
# cargo vendor && tar Jcvf ../%%{crate}-%%{version}-vendor.tar.xz vendor/ ; popd
Source1: %{crate}-%{version}-vendor.tar.xz
# Manually created patch for downstream crate metadata changes
# * default to the OpenSSL crypto backend of sequoia-openpgp
Patch: rpm-sequoia-fix-metadata.diff
%if 0%{?bundled_rust_deps}
BuildRequires: rust-toolset
# vendored openssl-sys
BuildRequires: openssl-devel
%else
BuildRequires: rust-packaging >= 23
%endif
%global _description %{expand:
An implementation of the RPM PGP interface using Sequoia.}
@ -57,18 +75,22 @@ Requires: %{crate}%{?_isa} = %{version}-%{release}
%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1
%if 0%{?bundled_rust_deps}
%cargo_prep -V 1
%else
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
%endif
%build
# build script uses environment variables to populate the pkgconfig file
export PREFIX="%{_prefix}"
export LIBDIR="%{_libdir}"
%cargo_build
%cargo_license_summary
%{cargo_license} > LICENSE.dependencies
%{?cargo_license_summary}
%{?cargo_license} > LICENSE.dependencies
%install
# install shared library

View File

@ -1 +1,2 @@
SHA512 (rpm-sequoia-1.4.0.crate) = ecb4afce1ab4697e652ab44eed1f4b778bf43f06f4befef92c2c1dba47b10f78f5bc5f769d838a55edb0e5e9abbe565c2e59c95a93d35df9bd2ef2fec20bd90e
SHA512 (rpm-sequoia-1.4.0-vendor.tar.xz) = ce6f3b6ba06f1e1144d690a4a4a7751911bc770072714c4ef76a18c05945da3c5696b37d416dfd70e6a8a8cfe38083e88f5b83ac9c0c0ad105bebe4a140ffb4f