From 90930c04f1d593269e2951162e5aa2833b4b80ac Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 19 May 2023 18:50:28 -0400 Subject: [PATCH] Fix RHEL/ELN builds The eln macro requires ELN SIG approval, and there is no need to differ from RHEL here. More importantly, we don't want the dynamic buildrequires in ELN either. RHEL/ELN cargo macros do not support -f, so import the RHEL/c9s patch which adds rdcore to the default features. While we're at it, use the RHEL %%cargo_prep -V to handle vendoring rather than manually modifing the cargo config. --- enable-rdcore.patch | 11 +++++++++++ rust-coreos-installer.spec | 29 +++++++++++++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 enable-rdcore.patch diff --git a/enable-rdcore.patch b/enable-rdcore.patch new file mode 100644 index 0000000..fd07a03 --- /dev/null +++ b/enable-rdcore.patch @@ -0,0 +1,11 @@ +diff -ur a/Cargo.toml b/Cargo.toml +--- a/Cargo.toml 1969-12-31 19:00:01.000000000 -0500 ++++ b/Cargo.toml 2023-03-14 07:57:14.025021766 -0400 +@@ -195,6 +195,7 @@ + + [features] + docgen = ["dep:clap_mangen"] ++default = ["rdcore"] + rdcore = [] + + [target."cfg(target_arch = \"s390x\")".dependencies.mbrman] diff --git a/rust-coreos-installer.spec b/rust-coreos-installer.spec index 9a56d3c..a219358 100644 --- a/rust-coreos-installer.spec +++ b/rust-coreos-installer.spec @@ -23,8 +23,12 @@ 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} && !0%{?eln} +%if 0%{?rhel} BuildRequires: rust-toolset BuildRequires: openssl-devel # To ensure we're not bundling system libraries @@ -79,17 +83,10 @@ Obsoletes: coreos-installer-dracut < 0.0.1 %description -n %{crate} %{_description} %prep -%autosetup -n %{crate}-%{version} -p1 -a 2 -%if 0%{?rhel} && !0%{?eln} -tar xvf %{SOURCE1} -mkdir -p .cargo -cat >.cargo/config << EOF -[source.crates-io] -replace-with = "vendored-sources" - -[source.vendored-sources] -directory = "vendor" -EOF +%autosetup -n %{crate}-%{version} -N -a 2 +%autopatch -p1 %{?!rhel:-M 999} +%if 0%{?rhel} +%cargo_prep -V 1 %else %cargo_prep %endif @@ -97,20 +94,20 @@ EOF # https://bugzilla.redhat.com/show_bug.cgi?id=1883457 sed -i 's/"-Ccodegen-units=1",//' .cargo/config -%if !0%{?rhel} || 0%{?eln} +%if !0%{?rhel} %generate_buildrequires %cargo_generate_buildrequires -f rdcore %endif %build -%if 0%{?rhel} && !0%{?eln} +%if 0%{?rhel} %cargo_build %else %cargo_build -f rdcore %endif %install -%if 0%{?rhel} && !0%{?eln} +%if 0%{?rhel} %make_install RELEASE=1 %else %cargo_install -f rdcore @@ -172,7 +169,7 @@ from the initramfs in IoT/Edge and is supported by the community. %if %{with check} %check -%if 0%{?rhel} && !0%{?eln} +%if 0%{?rhel} %cargo_test %else %cargo_test -f rdcore