[CI:BUILD] rpm: Make BuildRequires independent of the environment

The spec file had
  %if %{defined rhel} && 0%{?rhel} < 10
  %define gobuild(o:) ...
  %endif
  ...
  %if !%{defined gobuild}
  BuildRequires: go-rpm-macros
  %endif

The intent apparently was to use BR:go-rpm-macros where available, and define
%gobuild as a fallback where they are not available. This was unreliable,
because the package may have been installed already, and then %gobuild would be
defined when the srpm was being built, and then the srpm would NOT have the BR.

Instead, use the same condition to wrap the definition of %gobuild and the BR
lines to that the BR is always emitted when appropriate.

From: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>

This is a copy-paste of commit be971d6fb in podman fedora dist-git.

[NO NEW TESTS NEEDED]

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
Lokesh Mandvekar
2024-02-27 16:38:48 +05:30
parent 2f88c0a170
commit cc7b19279a

View File

@ -81,7 +81,7 @@ BuildRequires: glibc-devel
BuildRequires: glibc-static
BuildRequires: golang
BuildRequires: git-core
%if !%{defined gobuild}
%if %{undefined rhel} || 0%{?rhel} >= 10
BuildRequires: go-rpm-macros
%endif
BuildRequires: gpgme-devel