Re: Conditional comparision doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/09/2011 08:52 PM, Bruno Wolff III wrote:
> On Sat, Apr 09, 2011 at 19:48:47 +0200,
>    Michael Schwendt<mschwendt@xxxxxxxxx>  wrote:
>>
>> $ rpmdev-vercmp 4.8.10 4.8.3
>> 0:4.8.10-None is newer
>
> Would it be possible to run something like:
> rpmdev-vercmp 4.8.10 4.8.3>  /dev/null;echo $?
> in the spec file and compare the output to 0, 11 or 12?

Just FWIW, in rpm >= 4.7.0 you can use Lua for this, eg:

rpm --eval "%{lua:print(rpm.vercmp('4.8.10', '4.8.3'))}"

Of course inside a spec you don't need to execute rpm for that, you'd 
just use something like

%if %{lua:rpm.vercmp('4.8.10', '4.8.3')} > 0
...
%endif
--
packaging mailing list
packaging@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/packaging


[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux