Replace rdcore patch with %prep work

Since the RHEL rust toolbox does not support feature flags and
keeping a patch updated per release impacts automation. Add logic
to the %prep section to set the feature in the cargo.toml file.
This commit is contained in:
Steven Presti 2023-12-07 13:02:29 -05:00
parent 15aa50519b
commit ce3f7762dd
2 changed files with 7 additions and 20 deletions

View File

@ -1,13 +0,0 @@
diff --git a/Cargo.toml b/Cargo.toml
index 3eb81f7..011116a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -195,6 +195,7 @@ all-features = true
version = "^1.0"
[features]
+default = ["rdcore"]
docgen = [
"clap/string",
"dep:clap_mangen",

View File

@ -12,7 +12,7 @@
Name: rust-%{crate}
Version: 0.18.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Installer for Fedora CoreOS and RHEL CoreOS
# Upstream license specification: Apache-2.0
@ -23,10 +23,6 @@ Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{
Source1: https://github.com/coreos/%{crate}/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz
Source2: https://github.com/coreos/coreos-installer-dracut/archive/%{dracutcommit}/coreos-installer-dracut-%{dracutshortcommit}.tar.gz
## RHEL specific patches
# enable rdcore in default feature set (RHEL macros do not take -f)
Patch1000: enable-rdcore.patch
ExclusiveArch: %{rust_arches}
%if 0%{?rhel}
BuildRequires: rust-toolset
@ -83,9 +79,10 @@ Obsoletes: coreos-installer-dracut < 0.0.1
%description -n %{crate} %{_description}
%prep
%autosetup -n %{crate}-%{version} -N -a 2
%autopatch -p1 %{?!rhel:-M 999}
%autosetup -n %{crate}-%{version} -a 2 -p1
%if 0%{?rhel}
# Hackily enable rdcore manually on RHEL (RHEL macros do not take -f)
sed -i '/^\[features\]/a \ \ default = ["rdcore"]' Cargo.toml
%cargo_prep -V 1
%else
%cargo_prep
@ -177,6 +174,9 @@ from the initramfs in IoT/Edge and is supported by the community.
%endif
%changelog
* Thu Dec 07 2023 Steven Presti <spresti@redhat.com> - 0.18.0-3
- Remove rdcore patch, and move its logic into %prep
* Fri Dec 01 2023 Fabio Valentini <decathorpe@gmail.com> - 0.18.0-2
- Rebuild for openssl crate >= v0.10.60 (RUSTSEC-2023-0044, RUSTSEC-2023-0072)