RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Macro feature request: "once only" expansions ;-)

From: Jeff Johnson <n3npq@mac.com>
Date: Mon 28 Jan 2008 - 21:56:33 CET
Message-Id: <CDDA4E78-2198-4EAC-B59A-ADC145078F9D@mac.com>

On Jan 25, 2008, at 12:29 PM, Ralf S. Engelschall wrote:

>
>>
>>> I've needed/wanted an immediate expansion within macro files
>>> for years, just unwilling to listen to  the whiny "Incompatible!"
>>> hollering.
>>
>> Well, with an additional syntactical tag it should be just fine as it
>> means that the immediate expansion has to be explicitly requested.
>>
>> So, I see two tags: one which indicates that expansion should  
>> really be
>> performed immediately and the other indicating that the expansion  
>> should
>> be done once at the first expansion.
>
> Ok, I'm now solving my "speed issues" just fine with:
>
> | %once() %{expand:%%global %{*}}%{expand:%%{%{1}}}
> | [...]
> | %foo    %{once foo [...foo's body...]}
> | %bar    %{once bar [...bar's body...]}
>
> Nice trick! Works just fine...

;-)

I'd still like an "immediate" expansion while reading macros files
to pin down goosey-loosey values, as well as a more compact
syntax (':' will do, I'm still pondering
     %{:foo:}
as equivalent to
     %(once foo %{nil}}
and the scoping across all the other !?@-. macro marker magic.

Note: %global may be a push, not a pop everything and push single value,
which may lead to surprises with %{@foo} (or whatever the tuple  
return expansion
syntax was ...)

73 de Jeff
Received on Mon Jan 28 21:56:46 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.