diff --git a/.gitignore b/.gitignore index bb7204e..35a7372 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ SOURCES/coreos-installer-0.10.1-vendor.tar.gz SOURCES/coreos-installer-0.10.1.crate -SOURCES/coreos-installer-dracut-80d42a6.tar.gz +SOURCES/coreos-installer-dracut-9332fe5.tar.gz diff --git a/.rust-coreos-installer.metadata b/.rust-coreos-installer.metadata index 884ee99..387d16b 100644 --- a/.rust-coreos-installer.metadata +++ b/.rust-coreos-installer.metadata @@ -1,3 +1,3 @@ 19c823fcddba372dd7d897b93fda539c2e0bc101 SOURCES/coreos-installer-0.10.1-vendor.tar.gz 026193aadb28e0d70ce4f71b29e90d90dbc999c4 SOURCES/coreos-installer-0.10.1.crate -2cb25c4e17753322bce64a4b2ab35379b1f79ba9 SOURCES/coreos-installer-dracut-80d42a6.tar.gz +ab4a196d90af037303bacad800ff99ad333bae78 SOURCES/coreos-installer-dracut-9332fe5.tar.gz diff --git a/SPECS/rust-coreos-installer.spec b/SPECS/rust-coreos-installer.spec index 55a8780..f101ee4 100644 --- a/SPECS/rust-coreos-installer.spec +++ b/SPECS/rust-coreos-installer.spec @@ -1,27 +1,26 @@ -# Ganerated by rust2rpm 13 +# Generated by rust2rpm 16 %define dracutlibdir %{_prefix}/lib/dracut %bcond_without check %global __cargo_skip_build 0 # The library is for internal code reuse and is not a public API %global __cargo_is_lib 0 -%global coidracutcommit 80d42a6b34c0942309331f2533d1af61582f4320 -%global coidracutshortcommit %(c=%{coidracutcommit}; echo ${c:0:7}) +%global dracutcommit 9332fe55e1439abc88a4362248533437f7e767c3 +%global dracutshortcommit %(c=%{dracutcommit}; echo ${c:0:7}) %global crate coreos-installer Name: rust-%{crate} Version: 0.10.1 -Release: 4%{?dist} +Release: 6%{?dist} Summary: Installer for Fedora CoreOS and RHEL CoreOS # Upstream license specification: Apache-2.0 License: ASL 2.0 -URL: https://github.com/coreos/coreos-installer -Source: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate -Source1: https://github.com/coreos/coreos-installer/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz -Source2: https://github.com/runcom/coreos-installer-dracut/archive/%{coidracutcommit}/coreos-installer-dracut-%{coidracutshortcommit}.tar.gz - +URL: https://crates.io/crates/coreos-installer +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +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 # The RHEL 8 rust-toolset macros don't let us enable features from the # %%cargo_* macros. Enable rdcore directly in Cargo.toml. @@ -33,29 +32,16 @@ Patch0: enable-rdcore.patch Patch1: disable-lto.patch ExclusiveArch: %{rust_arches} +%if 0%{?rhel} && !0%{?eln} +BuildRequires: rust-toolset BuildRequires: openssl-devel BuildRequires: xz-devel -BuildRequires: rust-toolset -BuildRequires: systemd -# For tests -BuildRequires: gnupg2 - -Requires: gnupg -Requires: kpartx -Requires: systemd-udev -Requires: util-linux -%ifarch s390x -# This should eventually be spelled "s390utils-core" but the binaries -# haven't been broken out of s390utils-base yet -Requires: /usr/sbin/chreipl -Requires: /usr/sbin/dasdfmt -Requires: /usr/sbin/fdasd -Requires: /usr/sbin/lszdev -Requires: /usr/sbin/zipl +%else +BuildRequires: rust-packaging %endif - -#BuildRequires: rust-packaging -#BuildRequires: systemd-rpm-macros +BuildRequires: systemd-rpm-macros +# For tests +BuildRequires: gnupg2 %global _description %{expand: coreos-installer installs Fedora CoreOS or RHEL CoreOS to bare-metal @@ -74,11 +60,28 @@ Summary: %{summary} # zlib License: ASL 2.0 and MIT and zlib +Requires: gnupg +Requires: kpartx +Requires: systemd-udev +Requires: util-linux +%ifarch s390x +# This should be spelled "s390utils-core" but some of the binaries are +# still moving over from s390utils-base +Requires: /usr/sbin/chreipl +Requires: /usr/sbin/dasdfmt +Requires: /usr/sbin/fdasd +Requires: /usr/sbin/lszdev +Requires: /usr/sbin/zipl +%endif + # Since `rust-coreos-installer` creates a `coreos-installer` # subpackage with a newer version number, which supersedes the # deprecated `coreos-installer` package (https://src.fedoraproject.org/rpms/coreos-installer), # an explicit `Obsoletes:` for `coreos-installer` is not necessary. +# Obsolete dracut modules as they are not provided in this package. +Obsoletes: coreos-installer-dracut < 0.0.1 + %description -n %{crate} %{_description} %files -n %{crate} @@ -87,17 +90,51 @@ License: ASL 2.0 and MIT and zlib %{_bindir}/coreos-installer %prep -%autosetup -n %{crate}-%{version} -p1 -%setup -n %{crate}-%{version} -D -T -a 2 -%cargo_prep -V 1 -# https://github.com/rust-lang-nursery/error-chain/pull/289 -find -name '*.rs' -executable -exec chmod a-x {} \; +%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 +%else +%cargo_prep +%endif +# Fix SIGSEGV in tests on s390x +# https://bugzilla.redhat.com/show_bug.cgi?id=1883457 +sed -i 's/"-Ccodegen-units=1",//' .cargo/config + +%if !0%{?rhel} || 0%{?eln} +%generate_buildrequires +%cargo_generate_buildrequires -f rdcore +%endif %build +%if 0%{?rhel} && !0%{?eln} %cargo_build +%else +%cargo_build -f rdcore +%endif %install -%cargo_install +%if 0%{?rhel} && !0%{?eln} +%make_install +# 51coreos-installer for coreos-installer-dracut +install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/51coreos-installer/module-setup.sh +install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/systemd/coreos-installer.target +install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/scripts/coreos-installer-service +install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/scripts/coreos-installer-growfs +install -D -m 0644 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/systemd/coreos-installer.service +install -D -m 0644 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/systemd/coreos-installer-growfs.service +install -D -m 0644 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/systemd/coreos-installer-reboot.service +install -D -m 0644 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/systemd/coreos-installer-noreboot.service +install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{dracutcommit}/dracut/systemd/coreos-installer-generator +%else +%cargo_install -f rdcore # Install binaries, dracut modules, units, targets, generators for running via systemd install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/50rdcore dracut/50rdcore/module-setup.sh install -D -m 0755 -t %{buildroot}%{_libexecdir} scripts/coreos-installer-service @@ -111,16 +148,7 @@ install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/coreos-installer.target install -D -m 0644 -t %{buildroot}%{_unitdir} systemd/coreos-installer-post.target install -D -m 0755 -t %{buildroot}%{_systemdgeneratordir} systemd/coreos-installer-generator mv %{buildroot}%{_bindir}/rdcore %{buildroot}%{dracutlibdir}/modules.d/50rdcore/ -# 51coreos-installer for coreos-installer-dracut -install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/51coreos-installer/module-setup.sh -install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/systemd/coreos-installer.target -install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/scripts/coreos-installer-service -install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/scripts/coreos-installer-growfs -install -D -m 0644 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/systemd/coreos-installer.service -install -D -m 0644 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/systemd/coreos-installer-growfs.service -install -D -m 0644 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/systemd/coreos-installer-reboot.service -install -D -m 0644 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/systemd/coreos-installer-noreboot.service -install -D -m 0755 -t %{buildroot}%{dracutlibdir}/modules.d/51coreos-installer coreos-installer-dracut-%{coidracutcommit}/dracut/systemd/coreos-installer-generator +%endif %package -n %{crate}-bootinfra Summary: %{crate} boot-time infrastructure for use on Fedora/RHEL CoreOS @@ -142,14 +170,15 @@ This subpackage contains boot-time infrastructure for Fedora CoreOS and RHEL CoreOS. It is not needed on other platforms. %files -n %{crate}-bootinfra -%{dracutlibdir}/modules.d/50rdcore/* +%{dracutlibdir}/modules.d/* %{_libexecdir}/* %{_unitdir}/* %{_systemdgeneratordir}/* +%if 0%{?rhel} && !0%{?eln} %package -n %{crate}-dracut -Summary: %{crate} provides coreos-installer as a dracut module. -Requires: %{crate} = %{version}-%{release} +Summary: Dracut module for running coreos-installer in the initrd +Requires: %{crate} = %{version}-%{release} %description -n %{crate}-dracut This subpackage contains files and configuration to run coreos-installer @@ -157,13 +186,25 @@ from the initramfs. %files -n %{crate}-dracut %{dracutlibdir}/modules.d/51coreos-installer/* +%endif %if %{with check} %check +%if 0%{?rhel} && !0%{?eln} %cargo_test +%else +%cargo_test -f rdcore +%endif %endif %changelog +* Tue Nov 30 2021 Sohan Kunkerkar - 0.10.1-6 +- Vendor rust dependencies on RHEL only +- Add coreos-installer-dracut subpackage on RHEL only + +* Fri Nov 26 2021 Antonio Murdaca - 0.10.1-5 +- fix https://bugzilla.redhat.com/show_bug.cgi?id=2027255 + * Thu Nov 18 2021 Antonio Murdaca - 0.10.1-4 - fix dracut module dependencies