Re: [packages/rpm-pld-macros] - version 1.749: fixed _ver_* macros
On Mon, Sep 28, 2020 at 07:07:54PM +0200, Jakub Bogusz wrote: > 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 > > > 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. Fixed in 1.750. > > 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. A little nicer proposal: %if "%{_ver_ge '%{_rpmversion}' '4.6'}" == "1" Both false comparison or unexpanded macro evaluates to false condition. -- Jakub Boguszhttp://qboosh.pl/ ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: [packages/rpm-pld-macros] - version 1.749: fixed _ver_* macros
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 > > 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 Boguszhttp://qboosh.pl/ ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en
Re: [packages/rpm-pld-macros] - version 1.749: fixed _ver_* macros
On 27.09.2020 20:17, qboosh wrote: > commit a04002a841905f8c84ca1c955e047676994c1ef2 > Author: Jakub Bogusz > 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 ___ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en