Re: macro expansion problems

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

 



On Mon, Jul 30, 2018 at 01:30:41PM +0300, Panu Matilainen wrote:
> On 07/09/2018 12:42 PM, Adrian Reber wrote:
> > I am trying to define a macro and it seems I do not understand the macro
> > expansion correctly.
> > 
> > The macro I want to use, uses a variable which is defined later and I
> > cannot get it right. The following is a short example of what I would
> > like to do:
> > 
> > %global debug_package %{nil}
> > %global newname %(eval echo %{extname} | tr [a-z] [A-Z])
> > %global extname lower
> > Name: %{extname}
> > Version: 1
> > Release: 1
> > Summary: Summary
> > License: yes
> > %description
> > %{newname}
> > 
> > # rpmspec -q test.spec --parse
> > Name: lower
> > Version: 1
> > Release: 1
> > Summary: Summary
> > License: yes
> > %description
> > %{EXTNAME}
> > 
> > 
> > I understand the result but I tried many variants with expand to get it
> > working, but I failed. This is on CentOS 7.
> > 
> > Is it possible to change the value of a variable in a macro with a
> > variable which is defined later?
> 
> Yes, you just need to use %define to get lazy macro expansion, %global
> expands the body at time of definition. Using %define for "newname" macro
> definition gives you:
> 
> Name: lower
> Version: 1
> Release: 1
> Summary: Summary
> License: yes
> %description
> LOWER
> 
> ...which I suppose is the behavior you're after here.

Yes, perfect. Thanks.

> Yet another victim of Fedora's "%define is evil, use %global" misguided
> guidelines.

I guess you are right.

		Adrian
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list



[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux