RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Extending header extension tag syntax.

From: Jeff Johnson <n3npq@mac.com>
Date: Sun 11 May 2008 - 23:00:20 CEST
Message-Id: <4AC72AFC-E46C-4D89-A398-0E9D1BE69B11@mac.com>

On May 9, 2008, at 11:25 AM, Ralf S. Engelschall wrote:

> On Fri, May 09, 2008, Jeff Johnson wrote:
>
>>
>> 2) implicit vs explicit Lua header tag/format extensions.
>>      By explicit, I mean that I'd do something like
>> 	...:lua(function,arg1,arg2)
>>      because its easier to code up. But implictly overloading all the
>> tokens
>>      as possible lua function names could be done, is certainly  
>> prettier
>> even if
>>      slightly harder coding.
>>      is :lua(funcion,arg1,arg2) gud enuf initially?
>
> I think ":lua(...)" initially is certainly good enough.
>
>> Since I'm gonna be messing with the --queryformat parser, I'm  
>> likely going
>> to also see if I can't get syntax for a selector-by-value on tag  
>> contents,
>> something
>> like perl's "~=" like
>>     --qf '%{tag~=/pattern/:foo:bar}
>> at the same time.
>
> Good idea. I would use "%{tag:m/pattern/:foo:bar}" (filtering) and
> ""%{tag:s/pattern/subst/:foo:bar}" (adjusting) for the syntax.
>

I've got most of the preliminaries of a pipelined --queryformat  
implemented.

However, there's a fundamental design/architectuaral question I need  
to sort out
before chasing down patterns & lua hooks:

     Should elements in the --queryformat pipeline be destructive or  
not?

An example perhaps clarifies my question.

I have a :stat(...) format extractor that extracts st->st_foo when  
"foo" is
in the stat(...) extraction list, when the pipeline input is  a file  
path.

What I need to figgger is whether the following --queryformat pipelines
should have identical output (or not):

[jbj@wellfleet wdj]$ rpm -q --qf '%{filenames:stat(mode,uid)}\n' popt
040755 | 0
[jbj@wellfleet wdj]$ rpm -q --qf '%{filenames:stat(mode):stat(uid)} 
\n' popt
(Lstat:040755:No such file or directory)

IOW, should transformations in the pipeline map tokens on input directly
to output, or should transformations be permitted?

In Yet Other Words:
    Is a --queryformat pipeline a pipeline of extractors or  
transformers?

Patterns and lua wait on deciding the fundamental design issue.  
Meanwhile
I'm pretty pleased with the implementation so far, even if there are  
likely huge
flaws with type coercion and in-band error reporting (I'm sure I'm  
gonna hear
bugs about both of those issues).

Also: Perhaps '|' rather than ':' is a better pipeline element  
separator so that URI's
(with embedded ':') can be used in tag format extension parameters.  
But I haven't a clue atm ...

73 de Jeff



      --qu
>                                        Ralf S. Engelschall
>                                        rse@engelschall.com
>                                        www.engelschall.com
>
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> Developer Communication List                        rpm-devel@rpm5.org
Received on Sun May 11 23:01:37 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.