[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: %{echo: features

On Fri, Mar 21, 2003 at 07:21:25AM -0500, Michael Kohne wrote:
> At 05:52 PM 3/20/03 -0500, Jeff Johnson wrote:
> >macros were never designed to be useful in spec files, they were
> >designed to unify specfile/cli/system configuration.
> I've been following along on this discussion, and I have a question:
> If macros weren't designed for use in spec files, what is the general 
> solution when one needs to do large amounts of substitution in a spec file?

Macros were designed to unify configuration, not large amounts of
substitution, in spec files.

There's any number of tools, including sed, autoconf, m4, xml, etc.
all of which do text substitution on text files.

All are far better solutions for complicated expansions than
primitive lazy string substitution through macros, have better
control flow

Even if you choose use macros for large amounts of substitution, the
right place for the defining macros is outside of spec files in
configuration, which does support singly escaped new lines, your original

> My specific case is that I have a system with a main component and lots of 
> sub-components which I build as sub-rpms. The sub-components are all just 
> about identical except for their %package and %description sections. I 
> wanted to write a macro to generate the rest on the fly, so that I didn't 
> have to maintain a bunch of duplicates. Obviously, rpm macros aren't the 
> answer - is there a generally accepted way to do this? I guess what I need 
> is a pre-process step to generate my spec file - any favorite tools for 
> this job?

Try shell, invoke m4, there are zillions of solutions.

There are only 2 places, in preamble tags, and in the files list,
that there are times that setting a macro value is needed.

Everything can be done with scripts, or with %files -f and commonly
used system programs.

73 de Jeff

Jeff Johnson	ARS N3NPQ
jbj@redhat.com (jbj@jbj.org)
Chapel Hill, NC

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []