I don’t know where to find documentation for operator precedence in RPM
conditional expressions, but it looks like “!” binds more tightly than
“>=”, so
%if ! 0%{?rhel} >= 8
is grouped as
%if (! 0%{?rhel}) >= 8
which becomes, on Fedora:
%if (! 00) >= 8
%if 1 >= 8
and therefore evaluates false.
Writing
%if ! (0%{?rhel} >= 8)
seems to do what you want, as would:
%if 0%{?rhel} < 8
On 11/3/21 14:09, Sérgio Basto wrote:
> Hi,
>
> I just notice build in mock or koji this scriptlet [1] on a build for
> Fedora gives me "is rhel 8 or 9" , what I'm missing ?
>
>
> Thank you
>
> [1]
> %if ! 0%{?rhel} >= 8
> echo "is not rhel >= 8"
> %else
> echo "is rhel 8 or 9"
> %endif
>