[Fedora-packaging] Conditional comparision doesn't work
Panu Matilainen
pmatilai at laiskiainen.org
Mon Apr 11 09:59:39 UTC 2011
On 04/09/2011 08:52 PM, Bruno Wolff III wrote:
> On Sat, Apr 09, 2011 at 19:48:47 +0200,
> Michael Schwendt<mschwendt at gmail.com> 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
More information about the packaging
mailing list