Simplify Rust conditionals

We can greatly simplify the Rust goop now since:

1. upstream now hard requires Rust, so there's no need to make a
   conditional for `--enable-rust`.
2. we're not rebasing rpm-ostree in f27, so we can simplify the `>= 28`
   conditionals
3. el7 is strictly backports only, so we can simplify the `0%{?rhel}`
   conditionals (though we still want to support CentOS 7)
4. the new recommended way of using Rust in el8 is to just
   `BuildRequires: rust-toolset`, so we can drop all the SCL crud.
This commit is contained in:
Jonathan Lebon 2018-12-04 14:45:04 -05:00
parent d8a5bf5d7a
commit 634dc19315

View File

@ -1,16 +1,3 @@
# Upstream has --enable-rust, but let's use it by default in Fedora
# Note the Rust sources are in the tarball using cargo-vendor.
# For RHEL > 7 we need the toolset.
%if 0%{?fedora} >= 28 || 0%{?rhel} > 7
%bcond_without rust
%if 0%{?rhel} > 7
%define rusttoolset_version rust-toolset-1.26
%define rusttoolset scl enable %{rusttoolset_version} --
%endif
%else
%bcond_with rust
%endif
Summary: Hybrid image/package system
Name: rpm-ostree
Version: 2018.9
@ -25,25 +12,23 @@ URL: https://github.com/projectatomic/rpm-ostree
Patch0: 0001-rust-Drop-crates-io-patch-and-use-0.4.0.patch
Patch1: 0001-compose-Don-t-require-SELinux-policy-in-legacy-path.patch
%if %{with rust}
%if !%{defined rust_arches}
# It's not defined yet in the base CentOS7 root
%define rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x
%endif # defined rust_arches
%if !%{defined rust_arches}
# It's not defined yet in the base CentOS7 root
%define rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x
%endif # defined rust_arches
ExclusiveArch: %{rust_arches}
%if %{defined rusttoolset_version}
BuildRequires: %{rusttoolset_version}-cargo
BuildRequires: %{rusttoolset_version}-rust
BuildRequires: %{rusttoolset_version}-runtime
%else
# This one is only in Fedora, we're not actually using it right now
# but we may in the future.
%if 0%{?fedora} >= 28
%if 0%{?fedora}
BuildRequires: rust-packaging
%endif
%else
%if 0%{?rhel} < 8
# really, this is for CentOS 7 (CAHC)
BuildRequires: cargo
%endif # defined rusttoolset_version
%endif # with_rust
%else
BuildRequires: rust-toolset
%endif
%endif
# For the autofiles bits below
BuildRequires: /usr/bin/python3
@ -133,16 +118,12 @@ The %{name}-devel package includes the header files for %{name}-libs.
%autosetup -Sgit -n %{name}-%{version}
%build
%{?rusttoolset} env NOCONFIGURE=1 ./autogen.sh
# Override the invocation of ./configure, since %%configure is multi-line, we
# can't just prefix it with scl enable.
%define _configure %{?rusttoolset} ./configure
%configure --disable-silent-rules --enable-gtk-doc \
%{?with_rust:--enable-rust}
%{?rusttoolset} make %{?_smp_mflags}
env NOCONFIGURE=1 ./autogen.sh
%configure --disable-silent-rules --enable-gtk-doc
make %{?_smp_mflags}
%install
%{?rusttoolset} make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p -c"
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p -c"
find $RPM_BUILD_ROOT -name '*.la' -delete
# I try to do continuous delivery via rpmdistro-gitoverlay while
@ -202,6 +183,9 @@ $PYTHON autofiles.py > files.devel \
%files devel -f files.devel
%changelog
* Tue Dec 04 2018 Jonathan Lebon <jonathan@jlebon.com>
- Simplify Rust conditionals
* Fri Nov 02 2018 Jonathan Lebon <jonathan@jlebon.com> - 2018.9-3
- Backport patch for https://pagure.io/dusty/failed-composes/issue/956