[Rpm-maint] parametrized macro

Mark Hatle mark.hatle at windriver.com
Wed Nov 14 17:54:49 UTC 2007


Instead of %define use %global.

This behavior has to do with the way macros are added and removed from
the stack.  I don't understand exactly.. but global is the normal solution.

--Mark

Seweryn Walentynowicz wrote:
> Hello,
> 
> 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 behavior ?
>    Thanks for advance.
> 
>          Seweryn Walentynowicz
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Rpm-maint mailing list
> Rpm-maint at lists.rpm.org
> https://lists.rpm.org/mailman/listinfo/rpm-maint




More information about the Rpm-maint mailing list