[Rpm-maint] parametrized macro

Seweryn Walentynowicz seweryn.walentynowicz at gmail.com
Tue Nov 13 20:38:08 UTC 2007


I have some problems with macro definition in my specfile.
It is simplified example of my spec file:

#  this macro is only for easy debugging
%define is_defined() %{expand:Macro %{1} is %%{?!%{1}:not } defined.}
# lets define macro1 first, its body is meaningless, simply print one space
%define macro1 %{echo: }
# if macro3 wasn't defined, define parametrized macro2 as call to macro1
%{?!macro3:%define macro2() %macro1}
# testing, that macro2 is defined here
%{echo: BEFORE:%{is_defined macro2} }
# and now call to macro2 with parameter
%{macro2 parameter}
# after above call macro2 is not further defined. Why !?!
# test this:
%{echo: AFTER:%{is_defined macro2} }
... all typical spec file keyword definition, Summary, Name, Version.
Release, etc.

and now I build this package with -bp command. At BEFORE label macro2 is
defined, but  in line with AFTER  label is not.
I can't understand this. It is my indolence, bug or feature ?
 if macro2 is not parametrized macro,  or is defined with %global keyword
against %define as above all works fine, as I expected.
Could anyone explain me this behaviour ?
   Thanks for advance.

         Seweryn Walentynowicz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rpm.org/pipermail/rpm-maint/attachments/20071113/569be6b6/attachment-0001.htm 

More information about the Rpm-maint mailing list