On Thu, Dec 27, 2007, Jeff Johnson wrote:

> On Dec 27, 2007, at 11:35 AM, Jeff Johnson wrote:
>> On Dec 27, 2007, at 11:30 AM, Ralf S. Engelschall wrote:
>>> On Thu, Dec 27, 2007, Jeff Johnson wrote:
>>>
>>>> This patch. although more convoluted than simple,
>>>> is likelier a better forward looking approach to
>>>> accessing metadata uniformly no matter what
>>>> the RPM_FOO_TYPE, or whether its a macro or a tag
>>>> or an array or lua or ....
>>>>
>>>> https://lists.dulug.duke.edu/pipermail/rpm-maint/2007-November/000567.html
>>>>
>>>> The patch is integrated (although largely untested
>>>> and unused other than as a means to popuate
>>>> RPMTAG_BUILDMACROS so far).
>>>
>>> Well, if you looked at my recent RPM Lua hacks in detail you will
>>> see that I'm actually using rpm.macros() in all of them. This
>>> *IS* exactly this patch you have applied. My OpenPKG-specific
>>> "append-tag-value-to-macro" patch I applied today just allows one in Lua
>>> to fetch from rpm.macros() all(!) values of a tag, not just the last
>>> one.
>>
>> Good.
>>
>> There are two possible implementations available with macros
>> if you need/want a tuple.
>>
>> CSV is one, but note also that macro values are stacks, all the
>> previous values are there, just not top-of-stack.
>
> I should be less oblique:
>
> A macro primitive to coalesce a stack into a CSV list is what I'd like to
> see.

YES, YES, YES! Exactly *THIS* would be what we really need! I was not
aware that the old values are still preserved on a stack. So, please
let us implement a "stack to string" function which gets a seperator
string (e.g. ", ") and a macro name and returns a string of all the
macro values, separated by the separator string.

The macro syntax for this functionality could be something like
"%{@<name>[:<separator>]}", i.e., the "@" indicates an array (as in
Perl: an at-sign is a stylistic "a" and means "array" ;-). But please
feel free to choose whatever characters fits best for you -- I do not
care about this here. The default for <separator> is "", of course. So,
"[EMAIL PROTECTED]:, }" would result in what is currently hard-coded.

As you know the macro implementation better, can you implement such a
useful functionality, Jeff?
                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
                                       www.engelschall.com

______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        [email protected]

Reply via email to