RPM Community Forums

Mailing List Message of <rpm-devel>

Re: Arbitrary section/script questions

From: Jeff Johnson <n3npq@mac.com>
Date: Sat 15 Dec 2007 - 14:52:02 CET
Message-Id: <60AF6907-FF14-474A-A5FF-6BBDEBC23360@mac.com>

On Dec 15, 2007, at 6:04 AM, Ralf S. Engelschall wrote:

> On Sat, Dec 15, 2007, Ralf S. Engelschall wrote:
>
>> I've two questions related to arbitrary sections/scripts which I  
>> was not
>> able to answer myself:
>>
>> 1. When I use...
>>
>>    | %foo
>>    |     foo
>>
>>    ...RPM does not complain about the section "%foo" not known. Why
>>    isn't there also an %{_arbitrary_script} macro similar to what
>>    %{_arbitrary_tags} does to restrict the allowed non-standard  
>> script
>>    sections?
>>
>> 2. How can I query the "%foo" from (a) the *.spec, from (b)  
>> the .src.rpm
>>    and from (c) a binary RPM? Because only if I later can query the
>>    stuff placed into such a section it is useful, of course.
>
> Oh, sorry, I forgot to mention: the reason why I'm now also evaluating
> the possibility to use arbitrary script sections is because I cannot
> easily place arbitrary text (which even includes newlines) into an
> arbitrary tag. So I thought: "well, then stuff the text into a script
> section, there doesn't seem to be those constaints..."
>

RPM does not complain because of a lack of grammar. Known "%foo"
items are detected by the parse; otherwise the "%foo" section is just  
appended
to previous section.

I've also not added "%foo" syntax changes, only "Foo:" changes,  
because of the
lack of grammar problem mentioned, and because scriptlets imply an  
interpreter
tag, and usually look like
     %foo -p "/bin/foo --bar baz"
all of which starts to look very un-"arbitrary".

These items are already in the TODO:

     - jbj: arbitrary "%foo -p /bar" scriptlets as pair'ed RPMTAG_ 
{FOO,FOOPROG}.
     - jbj: arbitrary triggers, like scriptlets, but with a condition  
check too.

A proof-of-concept "%foo" implementation is likely no more than a  
couple of hours
if you need however.

And there's another long-standing flaw with trailing comments that  
needs fixing. Consider
the parsing of this snippet:

# Here is a comment describing reasons for %foo
%foo
   # do something
    /bin/true

# Here is a comment describing %bar context
%bar
    # do something
    /bin/true

While that order looks perfectly natural  in a *.spec file, the prefix
comments can end-up in the wrong tag body (and arguably all comments
in scriptlets represented in headers should be eliminated).

73 de Jeff

>                                        Ralf S. Engelschall
>                                        rse@engelschall.com
>                                        www.engelschall.com
>
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> Developer Communication List                        rpm-devel@rpm5.org
Received on Sat Dec 15 14:53:04 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.