[libvirt PATCH 0/3] spec: Fix platform check

Andrea Bolognani (3): spec: Reintroduce supported_platform variable spec: Move definition of supported_platform variable spec: Simplify platform check libvirt.spec.in | 12 +++++++++--- mingw-libvirt.spec.in | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) -- 2.26.3

The rewritten checks, which made it possible to drop the variable, are in fact not equivalent to the original ones, and rewriting them once again so that they are would make them unwieldy. Let's go back to how things were. Reverts: 69c8d5954ec4c5be22c2ebe313dbdc6c3f98c7b5 Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- libvirt.spec.in | 12 +++++++++--- mingw-libvirt.spec.in | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 9dea6c6787..013c7742a2 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -6,6 +6,12 @@ %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 @@ -923,9 +929,9 @@ Libvirt plugin for NSS for translating domain names into IP addresses. %autosetup -S git_am %build -%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 +%if ! %{supported_platform} +echo "This RPM requires either Fedora >= %{min_fedora} or RHEL >= %{min_rhel}" +exit 1 %endif %if %{with_qemu} diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in index 61a4843fb3..84b8998f74 100644 --- a/mingw-libvirt.spec.in +++ b/mingw-libvirt.spec.in @@ -5,6 +5,12 @@ # 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} @@ -89,9 +95,9 @@ MinGW Windows libvirt virtualization library. %setup -q -n libvirt-%{version} %build -%if 0%{?fedora} < %{min_fedora} - echo "This RPM requires Fedora >= %{min_fedora}" - exit 1 +%if ! %{supported_platform} +echo "This RPM requires Fedora >= %{min_fedora}" +exit 1 %endif %mingw_meson \ -- 2.26.3

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@redhat.com> --- libvirt.spec.in | 12 ++++++------ mingw-libvirt.spec.in | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 013c7742a2..5766af2255 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,6 +923,12 @@ Libvirt plugin for NSS for translating domain names into IP addresses. %autosetup -S git_am %build +%if 0%{?fedora} >= %{min_fedora} || 0%{?rhel} >= %{min_rhel} + %define supported_platform 1 +%else + %define supported_platform 0 +%endif + %if ! %{supported_platform} echo "This RPM requires either Fedora >= %{min_fedora} or RHEL >= %{min_rhel}" exit 1 diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in index 84b8998f74..3068607908 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,6 +89,12 @@ MinGW Windows libvirt virtualization library. %setup -q -n libvirt-%{version} %build +%if 0%{?fedora} && 0%{?fedora} >= %{min_fedora} + %define supported_platform 1 +%else + %define supported_platform 0 +%endif + %if ! %{supported_platform} echo "This RPM requires Fedora >= %{min_fedora}" exit 1 -- 2.26.3

No need to check whether we're on Fedora, because checking whether the version of Fedora is recent enough implictly does that already. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- mingw-libvirt.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in index 3068607908..4674d7887a 100644 --- a/mingw-libvirt.spec.in +++ b/mingw-libvirt.spec.in @@ -89,7 +89,7 @@ MinGW Windows libvirt virtualization library. %setup -q -n libvirt-%{version} %build -%if 0%{?fedora} && 0%{?fedora} >= %{min_fedora} +%if 0%{?fedora} >= %{min_fedora} %define supported_platform 1 %else %define supported_platform 0 -- 2.26.3

On Tue, May 11, 2021 at 11:21 AM Andrea Bolognani <abologna@redhat.com> wrote:
Andrea Bolognani (3): spec: Reintroduce supported_platform variable spec: Move definition of supported_platform variable spec: Simplify platform check
libvirt.spec.in | 12 +++++++++--- mingw-libvirt.spec.in | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-)
-- 2.26.3
This resolves my issues. Series LGTM. Reviewed-by: Neal Gompa <ngompa13@gmail.com> -- 真実はいつも一つ!/ Always, there's only one truth!
participants (2)
-
Andrea Bolognani
-
Neal Gompa