Check whether a macro is undefined or has a specific value

Daniel Neuberger daniel.neuberger at gmail.com
Tue Aug 16 13:45:01 UTC 2011


On 08/16/2011 07:22 AM, Marco wrote:
> as the subject says: If macro %{__foo} is defined and has value 1, I'd
> like to do something; otherwise (undefined or value != 1), skip.

See the section about defining conditional macros: 
http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch10s06.html#id508811

Here's an example that's similar to what you're talking about:

%define  _default_release 1
%define  _release 
%{!?_svn_last_rev:%{_default_release}}%{?_svn_last_rev:%{_svn_last_rev}}

I only know how to check for definition, not equality, but it shouldn't 
be too hard to make that work for you.

- Daniel



More information about the Rpm-list mailing list