RPM Community Forums

Mailing List Message of <rpm-cvs>

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

From: Jeff Johnson <jbj@rpm5.org>
Date: Sun 22 Jul 2007 - 04:44:48 CEST
Message-Id: <20070722024448.ACB963484F4@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   22-Jul-2007 04:44:48
  Branch: HEAD                             Handle: 2007072203444800

  Modified files:
    rpm                     CHANGES
    rpm/rpmio               macro.c

  Log:
    - (re-)add %{?dir/file} as shorthand for %{?dir:%{dir}/file}.

  Summary:
    Revision    Changes     Path
    1.1510      +1  -0      rpm/CHANGES
    2.136       +15 -2      rpm/rpmio/macro.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1509 -r1.1510 CHANGES
  --- rpm/CHANGES	22 Jul 2007 02:23:21 -0000	1.1509
  +++ rpm/CHANGES	22 Jul 2007 02:44:48 -0000	1.1510
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: (re-)add %{?dir/file} as shorthand for %{?dir:%{dir}/file}.
       - jbj: reapply 2.127 with more careful rpmExpand() fix.
       - jbj: scale _macro_BUFSIZE as 2 * BUFSIZ (16384) everywhere but rpmExpand()
       - jbj: use _macro_BUFSIZ, not compiled in BUFSIZ, to size expansion targets.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/macro.c
  ============================================================================
  $ cvs diff -u -r2.135 -r2.136 macro.c
  --- rpm/rpmio/macro.c	22 Jul 2007 02:23:21 -0000	2.135
  +++ rpm/rpmio/macro.c	22 Jul 2007 02:44:48 -0000	2.136
  @@ -1255,9 +1255,10 @@
       MacroEntry *mep;
       MacroEntry me;
       const char *s = mb->s, *se;
  +    const char *e, *ee;
       const char *f, *fe;
       const char *g, *ge;
  -    size_t fn, gn;
  +    size_t en, fn, gn;
       char *t = mb->t;	/* save expansion pointer for printExpand */
       int c;
       int rc = 0;
  @@ -1293,6 +1294,7 @@
   	}
   
   	/* Expand next macro */
  +	e = ee = NULL;
   	f = fe = NULL;
   	g = ge = NULL;
   	if (mb->depth > 1)	/* XXX full expansion for outermost level */
  @@ -1387,10 +1389,16 @@
   		default:
   			/*@innerbreak@*/ break;
   		}
  +		/* Reset to end-of-macro-name span. */
  +		for (e = f, ee = e; (c = *ee) && (xisalnum(c) || c == '_');)
  +			ee++;
   		/*@switchbreak@*/ break;
   	}
   
   	/* XXX Everything below expects fe > f */
  +	if (!e) e = f;
  +	if (!ee) ee = fe;
  +	en = (ee - e);
   	fn = (fe - f);
   	gn = (ge - g);
   	if ((fe - f) <= 0) {
  @@ -1524,7 +1532,7 @@
   	}
   
   	/* Expand defined macros */
  -	mep = findEntry(mb->mc, f, fn);
  +	mep = findEntry(mb->mc, e, en);
   	me = (mep ? *mep : NULL);
   
   	/* XXX Special processing for flags */
  @@ -1543,6 +1551,11 @@
   		if (me && me->body && *me->body) {/* Expand %{-f}/%{-f*} */
   			rc = expandT(mb, me->body, strlen(me->body));
   		}
  +		/* Append %{?_foo/bar}. */
  +		if (!g && se[-1] == '}' && *ee == '/') {
  +			while ((c = *ee++) && ee < se)
  +				SAVECHAR(mb, c);
  +		}
   		s = se;
   		continue;
   	}
  @@ .
Received on Sun Jul 22 04:44:48 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.