On Wed, May 5, 2021 at 4:12 PM Andrea Bolognani <abologna(a)redhat.com> wrote:
It's only used in one place, and it's nicer to keep the error
message close to the check that causes it to be emitted.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
libvirt.spec.in | 12 +++---------
mingw-libvirt.spec.in | 12 +++---------
2 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 013c7742a2..9dea6c6787 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -6,12 +6,6 @@
%define min_rhel 8
%define min_fedora 33
-%if 0%{?fedora} >= %{min_fedora} || 0%{?rhel} >= %{min_rhel}
- %define supported_platform 1
-%else
- %define supported_platform 0
-%endif
-
%define arches_qemu_kvm %{ix86} x86_64 %{power64} %{arm} aarch64 s390x
%if 0%{?rhel}
%define arches_qemu_kvm x86_64 aarch64 s390x
@@ -929,9 +923,9 @@ Libvirt plugin for NSS for translating domain names into IP
addresses.
%autosetup -S git_am
%build
-%if ! %{supported_platform}
-echo "This RPM requires either Fedora >= %{min_fedora} or RHEL >=
%{min_rhel}"
-exit 1
+%if (0%{?fedora} && 0%{?fedora} < %{min_fedora}) || (0%{?rhel} &&
0%{?rhel} < %{min_rhel})
+ echo "This RPM requires either Fedora >= %{min_fedora} or RHEL >=
%{min_rhel}"
+ exit 1
%endif
This broke my builds locally, because now the libvirt spec throws an
error on Fedora and RHEL. Your conditional logic will always trigger
an error because you're now checking to see if *either* Fedora < 33 or
RHEL < 7, and that will always be true and fail the build. :(
I'm going to send a fixup for this.
%if %{with_qemu}
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index 84b8998f74..61a4843fb3 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -5,12 +5,6 @@
# or versions, but no effort will be made to ensure that going forward.
%define min_fedora 33
-%if 0%{?fedora} && 0%{?fedora} >= %{min_fedora}
- %define supported_platform 1
-%else
- %define supported_platform 0
-%endif
-
Name: mingw-libvirt
Version: @VERSION@
Release: 1%{?dist}
@@ -95,9 +89,9 @@ MinGW Windows libvirt virtualization library.
%setup -q -n libvirt-%{version}
%build
-%if ! %{supported_platform}
-echo "This RPM requires Fedora >= %{min_fedora}"
-exit 1
+%if 0%{?fedora} < %{min_fedora}
+ echo "This RPM requires Fedora >= %{min_fedora}"
+ exit 1
%endif
%mingw_meson \
--
2.26.3
--
真実はいつも一つ!/ Always, there's only one truth!