RPM Community Forums

Mailing List Message of <rpm-cvs>

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

From: Jeff Johnson <jbj@rpm5.org>
Date: Thu 27 Dec 2007 - 21:12:26 CET
Message-Id: <20071227201227.01B7134845C@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:   27-Dec-2007 21:12:26
  Branch: HEAD                             Handle: 2007122720122600

  Modified files:
    rpm                     CHANGES
    rpm/rpmio               macro.c

  Log:
    - convert %{@foo:|} to "foo|bar|quux" tuple. %@foo assumes CSV comma.

  Summary:
    Revision    Changes     Path
    1.2025      +1  -0      rpm/CHANGES
    2.162       +22 -5      rpm/rpmio/macro.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2024 -r1.2025 CHANGES
  --- rpm/CHANGES	27 Dec 2007 17:07:09 -0000	1.2024
  +++ rpm/CHANGES	27 Dec 2007 20:12:26 -0000	1.2025
  @@ -1,4 +1,5 @@
   5.0b3 -> 5.0b4:
  +    - jbj: convert %{@foo:|} to "foo|bar|quux" tuple. %@foo assumes CSV comma.
       - rse: implement "rpm --undefine <macro>" as the counterpart to "rpm --define '<macro> <value>'"
       - afb: added %__objext,%__libext,%__shlibext,%__exeext for file extensions.
       - rse: make size of line buffer for .spec file parsing run-time configurable via macro _spec_line_buffer_size
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/macro.c
  ============================================================================
  $ cvs diff -u -r2.161 -r2.162 macro.c
  --- rpm/rpmio/macro.c	27 Dec 2007 09:11:21 -0000	2.161
  +++ rpm/rpmio/macro.c	27 Dec 2007 20:12:26 -0000	2.162
  @@ -1329,6 +1329,7 @@
       int c;
       int rc = 0;
       int negate;
  +    int stackarray;
       const char * lastc;
       int chkexist;
   
  @@ -1363,13 +1364,15 @@
   	g = ge = NULL;
   	if (mb->depth > 1)	/* XXX full expansion for outermost level */
   		t = mb->t;	/* save expansion pointer for printExpand */
  -	negate = 0;
  +	stackarray = chkexist = negate = 0;
   	lastc = NULL;
  -	chkexist = 0;
   	switch ((c = (int) *s)) {
   	default:		/* %name substitution */
  -		while (*s != '\0' && strchr("!?", *s) != NULL) {
  +		while (*s != '\0' && strchr("!?@", *s) != NULL) {
   			switch(*s++) {
  +			case '@':
  +				stackarray = ((stackarray + 1) % 2);
  +				/*@switchbreak@*/ break;
   			case '!':
   				negate = ((negate + 1) % 2);
   				/*@switchbreak@*/ break;
  @@ -1429,8 +1432,11 @@
   		}
   		f = s+1;/* skip { */
   		se++;	/* skip } */
  -		while (strchr("!?", *f) != NULL) {
  +		while (strchr("!?@", *f) != NULL) {
   			switch(*f++) {
  +			case '@':
  +				stackarray = ((stackarray + 1) % 2);
  +				/*@switchbreak@*/ break;
   			case '!':
   				negate = ((negate + 1) % 2);
   				/*@switchbreak@*/ break;
  @@ -1637,7 +1643,7 @@
   		s = se;
   		continue;
   	}
  -	
  +
   	if (me == NULL) {	/* leave unknown %... as is */
   #ifndef HACK
   #if DEAD
  @@ -1665,6 +1671,17 @@
   		continue;
   	}
   
  +	/* XXX Special processing to create a tuple from stack'd values. */
  +	if (stackarray) {
  +		c = ((g && g < ge) ? *g : ',');
  +		do {
  +			if (me != *mep)	SAVECHAR(mb, c);
  +			rc = expandT(mb, me->body, strlen(me->body));
  +		} while ((me = me->prev) != NULL);
  +		s = se;
  +		continue;
  +	}
  +
   	/* Setup args for "%name " macros with opts */
   	if (me && me->opts != NULL) {
   		if (lastc != NULL) {
  @@ .
Received on Thu Dec 27 21:12:27 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.