Detecting version in a SPEC file

Lamont Peterson lamont at gurulabs.com
Sat Mar 10 16:15:40 UTC 2007


On Monday 19 February 2007 06:13am, Jesse Keating wrote:
> On Monday 19 February 2007 07:57, Jos Vos wrote:
> > I don't know about Fedora, but on RHEL nothing on the system predefines
> > the %rhel macro, that's purely an internal define in the RH build system.
>
> Correct, both Fedora and RHEL (5+)'s buildsystem defines %fedora for fedora
> and %rhel for RHEL, as part of the definition of %{?dist} to .el5 for
> RHEL, .fc5 for Fedora Core 5, .fc6 for Fedora Core 6, and .fc7 for Fedora
> 7. All it requires is a macro file on the system building the packages for
> you that defines these macros.

Because of that, this technique really doesn't work for this package.

For this RPM, I want to conditionally select which patch to apply based on the 
version of he installed gnupg package on the system it is building on.  
rpmbuild already has this information somewhere internally as it can compare 
versions for BuildRequires: lines.

I'm looking for "something_that_gets_version" to use something like this:

%define gnupg_version "%something_that_gets_version gnupg"
%if "%gnupg_version" = "1.2"
   Patch1:     GnuPG-Interface-0.33.test-results-1.2.patch
   BuildRequires: gpg = 1.2
%else
   Patch1:     GnuPG-Interface-0.33.test-results-1.4.patch
   BuildRequires: gpg >= %{gnupg_version}
%endif

I need it to work for all sorts of distros, not just RHEL, FC and not just 
within buildsystems.

Is there such a mechanism available for use in the SPEC file or do I need to 
execure an external rpm command to query for that on my own?
-- 
Lamont Peterson <lamont at gurulabs.com>
Senior Instructor
Guru Labs, L.C. [ http://www.GuruLabs.com/ ]

NOTE:  All messages from this email address should be digitally signed with my
       0xDC0DD409 GPG key. It is available on the pgp.mit.edu keyserver as
       well as other keyservers that sync with MIT's.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-devel-list/attachments/20070310/b576757e/attachment.sig>


More information about the fedora-devel-list mailing list