Mailinglist Archive: opensuse-packaging (99 mails)

< Previous Next >
Re: [opensuse-packaging] How to detect package's version in specfile?
  • From: Marguerite Su <i@xxxxxxxxxxxxx>
  • Date: Thu, 1 Nov 2012 03:15:14 +0800
  • Message-id: <>
On Tue, Oct 30, 2012 at 7:20 PM, Guido Berhoerster <gber@xxxxxxxxxxxx> wrote:
Numeric comparisons only work with integers, if you only need to
compare the major version you can get away with:
%define xulrunner_major_ver %(rpm -q --queryformat %'%%{VERSION}\\n'
xulrunner-devel | sed 's|\\..*$||')
%if %xulrunner_major_ver >= 16

If you need a full rpm version string comparison you need a lua
if rpm.vercmp(rpm.expand("%(rpm -q --queryformat '%%{VERSION}'
xulrunner-devel)"), "16.0.0") >= 0 then
rpm.define("xulrunner_ge_16_0_0 1")
rpm.define("xulrunner_ge_16_0_0 0")
%if %xulrunner_ge_16_0_0

Thanks! That's it!

Not sure if so much black magic would pass a Factory review...

Don't worry...I used it to detect Tumbleweed in Packman...

To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >