RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/ CHANGES rpm/lib/ poptALL.c rpm/rpmio/ macro.c

From: Jeff Johnson <n3npq@mac.com>
Date: Fri 28 Dec 2007 - 14:32:35 CET
Message-Id: <47EF8DF5-8AE0-442B-A756-A0C1104E4C40@mac.com>
Careful --

Yes --predefine is a hack, but so were --define and --eval at
other points in rpm development. Still hacks imho ...

The goal of macros was to unify CLI options, specfile
parameters, and rpmrc configuration when building packages.

A specific non-goal of macros was to provide a reasonable framework
for building recipes, scriptlets in shell are (and were) the chosen  
means to
specify build recipes.

One _WILL_ get different results from using CLI options
only, what is seen duriing spec file parsing can be different. Adding
--predefine permitted diagnosis of the problem when someone
complained, and was an adequate hack-a-round for those who
simply do not understand anything _EXCEPT_
     You won't "fix" my widdle problem NOW?!?

Producing packages, not endlessly parameterizing builds,
was (and is imho) the goal of rpmbuild.

But I'm ecstatic there is a reason to finally get rid of --predefine.
Another passel of pain supporting rpm. Ptooey!

Thanks!

73 de Jeff

On Dec 28, 2007, at 6:26 AM, Ralf S. Engelschall wrote:

>   RPM Package Manager, CVS Repository
>   http://rpm5.org/cvs/
>    
> ______________________________________________________________________ 
> ______
>
>   Server: rpm5.org                         Name:   Ralf S. Engelschall
>   Root:   /v/rpm/cvs                       Email:  rse@rpm5.org
>   Module: rpm                              Date:   28-Dec-2007  
> 12:26:50
>   Branch: HEAD                             Handle: 2007122811264901
>
>   Modified files:
>     rpm                     CHANGES
>     rpm/lib                 poptALL.c
>     rpm/rpmio               macro.c
>
>   Log:
>     Fix %{@foo} macro stack expansion including also the value at  
> the stack
>     bottom and remove the confusing additional --predefine  
> behaviour when
>     --define is used as the very first CLI option, as this is both  
> a very
>     bad hack from the year 2002 and especially results in the value  
> of the
>     first --define option to occur twice on %{@foo} macro stack  
> expansions.
>
>   Summary:
>     Revision    Changes     Path
>     1.2029      +2  -0      rpm/CHANGES
>     2.68        +9  -0      rpm/lib/poptALL.c
>     2.166       +1  -1      rpm/rpmio/macro.c
>    
> ______________________________________________________________________ 
> ______
>
>   patch -p0 <<'@@ .'
>   Index: rpm/CHANGES
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r1.2028 -r1.2029 CHANGES
>   --- rpm/CHANGES	28 Dec 2007 01:50:11 -0000	1.2028
>   +++ rpm/CHANGES	28 Dec 2007 11:26:49 -0000	1.2029
>   @@ -1,4 +1,6 @@
>    5.0b3 -> 5.0b4:
>   +    - rse: fix %{@foo} macro stack expansion including also the  
> value at the stack bottom
>   +    - rse: remove the confusing additional --predefine behaviour  
> when --define is used as the first CLI option
>        - jbj: simplify expandFIFO().
>        - jbj: use "\n", not ",", as the default for %@foo expansion.
>        - jbj: fixup %{@foo:, } per rse comments.
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/lib/poptALL.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r2.67 -r2.68 poptALL.c
>   --- rpm/lib/poptALL.c	27 Dec 2007 17:07:09 -0000	2.67
>   +++ rpm/lib/poptALL.c	28 Dec 2007 11:26:50 -0000	2.68
>   @@ -217,9 +217,18 @@
>    	}
>    	t = s;
>    	if (*t == '%') t++;
>   +#if 0
>    	/* XXX Predefine macro if not initialized yet. */
>   +        /* rse: this is a very bad hack from the year 2002 which  
> especially results in
>   +           the value of the first --define option to occur twice  
> on %{@foo} macro stack
>   +           expansions. We have now disabled it because:
>   +           1. it is a very confusing sematic
>   +           2. it applies only to the absolutely first occurrence  
> of a --define usage
>   +           3. there is already the explicit --predefine in case  
> one really has to
>   +              define a macro before the config files are loaded. */
>    	if (rpmcliInitialized < 0)
>    	    (void) rpmDefineMacro(NULL, t, RMIL_CMDLINE);
>   +#endif
>    	rpmcliConfigured();
>    /*@-type@*/
>    	(void) rpmDefineMacro(NULL, t, RMIL_CMDLINE);
>   @@ .
>   patch -p0 <<'@@ .'
>   Index: rpm/rpmio/macro.c
>    
> ====================================================================== 
> ======
>   $ cvs diff -u -r2.165 -r2.166 macro.c
>   --- rpm/rpmio/macro.c	28 Dec 2007 01:50:11 -0000	2.165
>   +++ rpm/rpmio/macro.c	28 Dec 2007 11:26:50 -0000	2.166
>   @@ -1309,7 +1309,7 @@
>    {
>        int rc = 0;
>
>   -    if (me && me->prev && me->prev->prev) {
>   +    if (me && me->prev) {
>    	rc = expandFIFO(mb, me->prev, g, gn);
>    	rc = expandT(mb, g, gn);
>        }
>   @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Fri Dec 28 14:32:57 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.