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: <CAK0PdA=7a9MvfqJ0z9GM=ZNOeAeMcHSk9153AW3ELg05fk43rw@mail.gmail.com>
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
[...]
%endif

If you need a full rpm version string comparison you need a lua
macro:
%{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")
else
rpm.define("xulrunner_ge_16_0_0 0")
end
}
%if %xulrunner_ge_16_0_0
[...]
%endif

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

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

< Previous Next >