From a9bc99e47fe1bc457f42976dc997962830315520 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 12 Sep 2023 10:39:12 -0400 Subject: [PATCH] Use bundled rust deps in RHEL builds RHEL does not include individual Rust crate dependencies. Also, python-hypothesis is not available in RHEL, but the tests proceed without it. --- .gitignore | 1 + python-rpds-py.spec | 20 ++++++++++++++++---- sources | 1 + 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 6457d1c..27c6a65 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /rpds_py-0.9.2.tar.gz +/rpds_py-0.9.2-vendor.tar.xz diff --git a/python-rpds-py.spec b/python-rpds-py.spec index 3c52a34..ce3e972 100644 --- a/python-rpds-py.spec +++ b/python-rpds-py.spec @@ -8,14 +8,24 @@ Summary: Python bindings to the Rust rpds crate # Full license breakdown in LICENSES.dependencies License: MIT AND Apache-2.0 AND (MIT OR Apache-2.0) AND MPL-2.0 URL: https://github.com/crate-py/rpds -Source: %{pypi_source %{modname}} +Source0: %{pypi_source %{modname}} +# To create the vendor tarball: +# tar xf %%{name}-%%{version}.crate ; pushd %%{name}-%%{version} ; \ +# patch -p1 < ../bump-dependencies.patch && \ +# cargo vendor && tar Jcvf ../%%{name}-%%{version}-vendor.tar.xz vendor/ ; pushd +Source1: %{modname}-%{version}-vendor.tar.xz # Bump archery and rpds dependencies to v1.0.0 Patch: bump-dependencies.patch +%if 0%{?rhel} +BuildRequires: rust-toolset +%else BuildRequires: cargo-rpm-macros +%endif BuildRequires: dos2unix BuildRequires: python3-devel +BuildRequires: python3-pytest %global _description %{expand: Python bindings to the Rust rpds crate.} @@ -41,18 +51,20 @@ dos2unix README* LICENSE* *.pyi # The patch does not apply cleanly, we sed it out instead sed -i '/hypothesis/d' tests/requirements.in -%cargo_prep +%cargo_prep %{?rhel:-V 1} %generate_buildrequires %pyproject_buildrequires tests/requirements.in +%if %{undefined rhel} %cargo_generate_buildrequires +%endif %build export RUSTFLAGS='%{build_rustflags}' -%cargo_license_summary -%{cargo_license} > LICENSES.dependencies +%{?cargo_license_summary} +%{?cargo_license} > LICENSES.dependencies %pyproject_wheel diff --git a/sources b/sources index 7e2bd67..b648dae 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (rpds_py-0.9.2.tar.gz) = 5a3d1b4ca27cd9b73edf7c03c8def5350949a56df0a322e317a7d3e6e31933694fe21928218ebeb51074322dcde6e4f807283e0359f8f31b0ca6b69180be3260 +SHA512 (rpds_py-0.9.2-vendor.tar.xz) = 03e411adfd845beef2ba3697dee3953351addcbd51b6b2009bca106cef32e31cc924c7cb7954fb1e3a03145093e11c579882eef850403729381aeb3842ea8b3a