Vendor rust dependencies & add coreos-installer-dracut subpackage

Resolves: rhbz#2021611
This commit is contained in:
Sohan Kunkerkar 2021-11-30 10:19:36 -05:00
parent 1335c6ea07
commit 02467521ff

View File

@ -1,27 +1,26 @@
# Ganerated by rust2rpm 13 # Generated by rust2rpm 16
%define dracutlibdir %{_prefix}/lib/dracut %define dracutlibdir %{_prefix}/lib/dracut
%bcond_without check %bcond_without check
%global __cargo_skip_build 0 %global __cargo_skip_build 0
# The library is for internal code reuse and is not a public API # The library is for internal code reuse and is not a public API
%global __cargo_is_lib 0 %global __cargo_is_lib 0
%global coidracutcommit 9332fe55e1439abc88a4362248533437f7e767c3 %global dracutcommit 9332fe55e1439abc88a4362248533437f7e767c3
%global coidracutshortcommit %(c=%{coidracutcommit}; echo ${c:0:7}) %global dracutshortcommit %(c=%{dracutcommit}; echo ${c:0:7})
%global crate coreos-installer %global crate coreos-installer
Name: rust-%{crate} Name: rust-%{crate}
Version: 0.10.1 Version: 0.10.1
Release: 5%{?dist} Release: 6%{?dist}
Summary: Installer for Fedora CoreOS and RHEL CoreOS Summary: Installer for Fedora CoreOS and RHEL CoreOS
# Upstream license specification: Apache-2.0 # Upstream license specification: Apache-2.0
License: ASL 2.0 License: ASL 2.0
URL: https://github.com/coreos/coreos-installer URL: https://crates.io/crates/coreos-installer
Source: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate Source0: 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 Source1: https://github.com/coreos/%{crate}/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 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 # The RHEL 8 rust-toolset macros don't let us enable features from the
# %%cargo_* macros. Enable rdcore directly in Cargo.toml. # %%cargo_* macros. Enable rdcore directly in Cargo.toml.
@ -33,30 +32,17 @@ Patch0: enable-rdcore.patch
Patch1: disable-lto.patch Patch1: disable-lto.patch
ExclusiveArch: %{rust_arches} ExclusiveArch: %{rust_arches}
%if 0%{?rhel} && !0%{?eln}
BuildRequires: rust-toolset
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: xz-devel BuildRequires: xz-devel
BuildRequires: rust-toolset %else
BuildRequires: systemd BuildRequires: rust-packaging
%endif
BuildRequires: systemd-rpm-macros
# For tests # For tests
BuildRequires: gnupg2 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
%endif
#BuildRequires: rust-packaging
#BuildRequires: systemd-rpm-macros
%global _description %{expand: %global _description %{expand:
coreos-installer installs Fedora CoreOS or RHEL CoreOS to bare-metal coreos-installer installs Fedora CoreOS or RHEL CoreOS to bare-metal
machines (or, occasionally, to virtual machines). machines (or, occasionally, to virtual machines).
@ -74,11 +60,28 @@ Summary: %{summary}
# zlib # zlib
License: ASL 2.0 and MIT and 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` # Since `rust-coreos-installer` creates a `coreos-installer`
# subpackage with a newer version number, which supersedes the # subpackage with a newer version number, which supersedes the
# deprecated `coreos-installer` package (https://src.fedoraproject.org/rpms/coreos-installer), # deprecated `coreos-installer` package (https://src.fedoraproject.org/rpms/coreos-installer),
# an explicit `Obsoletes:` for `coreos-installer` is not necessary. # 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} %description -n %{crate} %{_description}
%files -n %{crate} %files -n %{crate}
@ -87,17 +90,51 @@ License: ASL 2.0 and MIT and zlib
%{_bindir}/coreos-installer %{_bindir}/coreos-installer
%prep %prep
%autosetup -n %{crate}-%{version} -p1 %autosetup -n %{crate}-%{version} -p1 -a 2
%setup -n %{crate}-%{version} -D -T -a 2 %if 0%{?rhel} && !0%{?eln}
%cargo_prep -V 1 tar xvf %{SOURCE1}
# https://github.com/rust-lang-nursery/error-chain/pull/289 mkdir -p .cargo
find -name '*.rs' -executable -exec chmod a-x {} \; 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 %build
%if 0%{?rhel} && !0%{?eln}
%cargo_build %cargo_build
%else
%cargo_build -f rdcore
%endif
%install %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 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}%{dracutlibdir}/modules.d/50rdcore dracut/50rdcore/module-setup.sh
install -D -m 0755 -t %{buildroot}%{_libexecdir} scripts/coreos-installer-service 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 0644 -t %{buildroot}%{_unitdir} systemd/coreos-installer-post.target
install -D -m 0755 -t %{buildroot}%{_systemdgeneratordir} systemd/coreos-installer-generator install -D -m 0755 -t %{buildroot}%{_systemdgeneratordir} systemd/coreos-installer-generator
mv %{buildroot}%{_bindir}/rdcore %{buildroot}%{dracutlibdir}/modules.d/50rdcore/ mv %{buildroot}%{_bindir}/rdcore %{buildroot}%{dracutlibdir}/modules.d/50rdcore/
# 51coreos-installer for coreos-installer-dracut %endif
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
%package -n %{crate}-bootinfra %package -n %{crate}-bootinfra
Summary: %{crate} boot-time infrastructure for use on Fedora/RHEL CoreOS Summary: %{crate} boot-time infrastructure for use on Fedora/RHEL CoreOS
@ -142,13 +170,14 @@ This subpackage contains boot-time infrastructure for Fedora CoreOS and
RHEL CoreOS. It is not needed on other platforms. RHEL CoreOS. It is not needed on other platforms.
%files -n %{crate}-bootinfra %files -n %{crate}-bootinfra
%{dracutlibdir}/modules.d/50rdcore/* %{dracutlibdir}/modules.d/*
%{_libexecdir}/* %{_libexecdir}/*
%{_unitdir}/* %{_unitdir}/*
%{_systemdgeneratordir}/* %{_systemdgeneratordir}/*
%if 0%{?rhel} && !0%{?eln}
%package -n %{crate}-dracut %package -n %{crate}-dracut
Summary: %{crate} provides coreos-installer as a dracut module. Summary: Dracut module for running coreos-installer in the initrd
Requires: %{crate} = %{version}-%{release} Requires: %{crate} = %{version}-%{release}
%description -n %{crate}-dracut %description -n %{crate}-dracut
@ -157,13 +186,22 @@ from the initramfs.
%files -n %{crate}-dracut %files -n %{crate}-dracut
%{dracutlibdir}/modules.d/51coreos-installer/* %{dracutlibdir}/modules.d/51coreos-installer/*
%endif
%if %{with check} %if %{with check}
%check %check
%if 0%{?rhel} && !0%{?eln}
%cargo_test %cargo_test
%else
%cargo_test -f rdcore
%endif
%endif %endif
%changelog %changelog
* Tue Nov 30 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 0.10.1-6
- Vendor rust dependencies on RHEL only
- Add coreos-installer-dracut subpackage on RHEL only
* Fri Nov 26 2021 Antonio Murdaca <runcom@linux.com> - 0.10.1-5 * Fri Nov 26 2021 Antonio Murdaca <runcom@linux.com> - 0.10.1-5
- fix https://bugzilla.redhat.com/show_bug.cgi?id=2027255 - fix https://bugzilla.redhat.com/show_bug.cgi?id=2027255