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

Jakub Bogusz qboosh at pld-linux.org
Mon Sep 28 19:07:54 CEST 2020


On Mon, Sep 28, 2020 at 04:41:21PM +0200, Jan Palus wrote:
> 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).

Ouch, you're right.

> ie rapidjson has:
> 
> %if %{_ver_ge "%{_rpmversion}" "4.6"}
> 
> which I suppose does not work correctly at the moment.

After fixing conditions it would work.

But throws parse error when too old (or no) macros are installed, so
I tried the following:

> 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?

%{?macro} construct returns macro value if it's defined.

But unfortunately it appears that doesn't pass arguments to macro, so the
result is equal to just %{_ver_ge} :/

%{?_ver_ge:%_ver_ge x y} works, but needs more keystrokes...
I'll try to look for nicer solution.


-- 
Jakub Bogusz    http://qboosh.pl/


More information about the pld-devel-en mailing list