Vendor rust dependencies on el9

This commit is contained in:
Sohan Kunkerkar 2021-09-15 15:13:09 -04:00 committed by Sohan Kunkerkar
parent 0a0394730c
commit e13a705fc7

View File

@ -8,17 +8,28 @@
Name: rust-%{crate}
Version: 5.1.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Simple cloud provider agent
# Upstream license specification: Apache-2.0
License: ASL 2.0
URL: https://crates.io/crates/afterburn
Source: %{crates_source}
Source0: %{crates_source}
%if 0%{?rhel} && !0%{?eln}
Source1: https://github.com/coreos/%{crate}/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz
%endif
ExclusiveArch: %{rust_arches}
%if 0%{?rhel} && !0%{?eln}
BuildRequires: rust-toolset
BuildRequires: openssl-devel
# This is needed because the cc crate, which is
# used for linking final build results of crates,
# does not work without it.
BuildRequires: glibc-devel
%else
BuildRequires: rust-packaging
%endif
BuildRequires: systemd
%global _description %{expand:
@ -85,24 +96,42 @@ to run in the initramfs on boot.
%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1
%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
# afterburn-sshkeys@.service is by default enabled for the 'core' user in
# Fedora CoreOS.
# Based on https://github.com/coreos/afterburn/blob/master/Makefile.
sed -e 's,@DEFAULT_INSTANCE@,core,' < \
systemd/afterburn-sshkeys@.service.in > \
systemd/afterburn-sshkeys@.service
%cargo_prep
%if !0%{?rhel} || 0%{?eln}
%generate_buildrequires
%cargo_generate_buildrequires
%endif
%build
%cargo_build
%install
%if 0%{?rhel} && !0%{?eln}
%make_install INSTALL="install -p -c"
%else
%cargo_install
install -Dpm0644 -t %{buildroot}%{_unitdir} \
systemd/*.service systemd/*.target
%endif
mkdir -p %{buildroot}%{dracutmodulesdir}
cp -a dracut/* %{buildroot}%{dracutmodulesdir}
@ -112,6 +141,9 @@ cp -a dracut/* %{buildroot}%{dracutmodulesdir}
%endif
%changelog
* Fri Sep 24 2021 Sohan Kunkerkar <skunkerk@redhat.com> - 5.1.0-3
- Vendor rust dependencies on el9
* Tue Sep 14 2021 Sahana Prasad <sahana@redhat.com> - 5.1.0-2
- Rebuilt with OpenSSL 3.0.0