[packages/rpm-pld-macros] - version 1.749: fixed _ver_* macros

Jan Palus atler at pld-linux.org
Mon Sep 28 16:41:21 CEST 2020


On 27.09.2020 20:17, qboosh wrote:
> commit a04002a841905f8c84ca1c955e047676994c1ef2
> Author: Jakub Bogusz <qboosh at pld-linux.org>
> Date:   Sun Sep 27 20:20:03 2020 +0200
> 
>     - version 1.749: fixed _ver_* macros
...
> -# BuildRequires:	rpmbuild(macros) >= 1.748
> -%_ver_lt()	%(test rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1 -eq 2; echo $?)
> -%_ver_ge()	!%(test rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1 -eq 2; echo $?)
> +# BuildRequires:	rpmbuild(macros) >= 1.749
> +%_ver_lt()	%(test $(rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1; echo $?) -eq 2; echo $?)
> +%_ver_ge()	%(test $(rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1; echo $?) -ne 2; echo $?)

Isn't it the other way? -ne 2 for_ver_lt and -eq 2 for _ver_ge?

"Satisfied condition" in terms of test return code (0) is the opposite
of "satisfied condition" as interpreted by rpm (1).

$ rpm -E '%{_ver_lt 0 0}'
1

$ rpm -E '%{_ver_lt 0 1}'
0

$ rpm -E '%{_ver_lt 1 0}'
1

$ rpm -E '%{_ver_ge 0 0}'
0

$ rpm -E '%{_ver_ge 5.4.15 4.6}'
0

$ rpm -q rpm-pld-macros-build
rpm-pld-macros-build-1.749-1.noarch


or how is it supposed to be used?

ie rapidjson has:

%if %{_ver_ge "%{_rpmversion}" "4.6"}

which I suppose does not work correctly at the moment.

while glabels has:

%if 0%{?_ver_ge "%{_rpmversion}" "4.6"}

but I don't quite get it, I thought %{? construct is only to check if
something is defined or does it somehow interpret return value?
It seems to return same value for all cases:

$ rpm -E '%{?_ver_ge 0 0}'
1

$ rpm -E '%{?_ver_ge 0 1}'
1

$ rpm -E '%{?_ver_ge 1 0}'
1


More information about the pld-devel-en mailing list