On Fri, Jul 20, 2007, Jeff Johnson wrote:

> On Jul 20, 2007, at 9:02 AM, Jeff Johnson wrote:

>>     grr, stoopid trailing '/' on directories. perhaps %{?foo/} expansion?
>>
>
> Having embarrassed myself with Yet Another Corner Case, the attached
> patch permits the rather clunky
>     %{?_dirpath:%{_dirpath}/file}
> to be written more compactly (and readably) as
>     %{?_dirpath/file}
>
> What I don't know is whether I should continue tricking up macro syntax.

In general I want to see more powerful macro expansion, but I recommend
to make the syntax more orthogonal and extensible. For instance, in
your above example the "/" really means just a slash. Also, as for
each feature a separating character after the macro name is required
and only a few character are available in ASCII one also visuably
recognized as such, I recommend to do use a more generalized syntax
and make the particular "path extension" just a special case of a
"string extension". For instance, let's say "+" is generic operator for
"string extension/concatenation" then you can achieve your example with
%{?_dirpath+/foo} and still support other ways of extensions, too.

> What say ye?

A few years ago we I've developed in the OSSP project a C library
named OSSP var (http://www.ossp.org/pkg/lib/var/) which IMHO uses
a orthogonal and flexible enough syntax and is also implemented
with a robust recursive descent parser which supports full nesting,
array expansions, multi-line matching, _custom_ operations, etc.
The best for you is: its array expansion uses the RPM query format
syntax "[...]" :-) If you want to be inspired have a look at:
http://www.ossp.org/man/man.cgi/pkg/lib/var/var.pod and especially at
the end under "EXAMPLE (USER)". Perhaps you find it as cool as I do. I
especially like the custom operations...

                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
                                       www.engelschall.com

______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to