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

Re: Detecting version in a SPEC file



On Sat, 2007-03-10 at 09:15 -0700, Lamont Peterson wrote:
> 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?

You could execute an `rpm -q` version query manually:

%define gnupg_ver_major_minor %(rpm -q gnupg --qf '%{version}' 2>/dev/null | cut -d '.' -f 1,2)

(That should all be on one line, in case it gets wrapped by your
mailer.)

In fact, if your patches are named accordingly, you might be able to use
that directly in the patch names:

Patch1:	GnuPG-Interface-0.33.test-results.%{gnupg_ver_major_minor}.patch

Hope that helps.
-- 
Peter Gordon (codergeek42) / FSF Associate Member #5015
GnuPG Public Key ID: 0xFFC19479 / Fingerprint:
  DD68 A414 56BD 6368 D957 9666 4268 CB7A FFC1 9479
Blog: http://thecodergeek.com/blog/ 
About: http://fedoraproject.org/wiki/PeterGordon

Attachment: signature.asc
Description: This is a digitally signed message part


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