RPM Community Forums

Mailing List Message of <rpm-cvs>

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

From: Jeff Johnson <jbj@rpm5.org>
Date: Sat 14 Jul 2007 - 22:01:40 CEST
Message-Id: <20070714200140.5D69B3484F1@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:   14-Jul-2007 22:01:40
  Branch: HEAD                             Handle: 2007071421013901

  Modified files:
    rpm                     CHANGES
    rpm/rpmio               .cvsignore macro.c

  Log:
    - fixup %patchNN rewrite.

  Summary:
    Revision    Changes     Path
    1.1462      +1  -0      rpm/CHANGES
    1.12        +1  -0      rpm/rpmio/.cvsignore
    2.123       +17 -21     rpm/rpmio/macro.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1461 -r1.1462 CHANGES
  --- rpm/CHANGES	14 Jul 2007 06:46:14 -0000	1.1461
  +++ rpm/CHANGES	14 Jul 2007 20:01:39 -0000	1.1462
  @@ -1,4 +1,5 @@
   4.5 -> 5.0:
  +    - jbj: fixup %patchNN rewrite.
       - jbj: add osgi automagic dependency extractors <klee@redhat.com>.
       - jbj: debugedit warning removal <pmatlai@redhat.com>.
       - jbj: free 5 bits in FCOLOR_e for future use. 
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/.cvsignore
  ============================================================================
  $ cvs diff -u -r1.11 -r1.12 .cvsignore
  --- rpm/rpmio/.cvsignore	26 Nov 2004 19:47:39 -0000	1.11
  +++ rpm/rpmio/.cvsignore	14 Jul 2007 20:01:40 -0000	1.12
  @@ -17,6 +17,7 @@
   thkp
   tinv
   tkey
  +tmacro
   tput
   tring
   trpmio
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/macro.c
  ============================================================================
  $ cvs diff -u -r2.122 -r2.123 macro.c
  --- rpm/rpmio/macro.c	13 Jul 2007 02:11:30 -0000	2.122
  +++ rpm/rpmio/macro.c	14 Jul 2007 20:01:40 -0000	2.123
  @@ -14,6 +14,7 @@
   #define	STREQ(_t, _f, _fn)	((_fn) == (sizeof(_t)-1) && !strncmp((_t), (_f), (_fn)))
   
   #ifdef DEBUG_MACROS
  +#undef	WITH_LUA	/* XXX fixme */
   #include <sys/types.h>
   #include <errno.h>
   #include <fcntl.h>
  @@ -1133,7 +1134,11 @@
   	buf[gn] = '\0';
   	(void) expandU(mb, buf, sizeof(buf));
       }
  -    if (STREQ("basename", f, fn)) {
  +    if (fn > 5 && STREQ("patch", f, 5) && xisdigit(f[5])) {
  +	b = buf;
  +	be = stpncpy( stpcpy(b, "%patch -P "), f+5, fn-5);
  +	*be = '\0';
  +    } else if (STREQ("basename", f, fn)) {
   	if ((b = strrchr(buf, '/')) == NULL)
   	    b = buf;
   	else
  @@ -1208,15 +1213,10 @@
   	    b++;
   	    sprintf(b, "%%PATCH%s", buf);
   	} else
  -			b = buf;
  +	    b = buf;
       } else if (STREQ("F", f, fn)) {
   	b = buf + strlen(buf) + 1;
   	sprintf(b, "file%s.file", buf);
  -    } else if (fn > 5 && STREQ("patch", f, fn >= 5 ? 5 : fn)) {
  -	strncpy(buf, f, fn);
  -	buf[fn]='\0';
  -	b = buf + fn + 1;
  -	sprintf(b, "%%patch -P %s", buf+5);
       }
   
       if (b) {
  @@ -1319,7 +1319,7 @@
   /*@-globs@*/
   		if ((c = *fe) && isblank(c))
   			if ((lastc = strchr(fe,'\n')) == NULL)
  -                lastc = strchr(fe, '\0');
  +				lastc = strchr(fe, '\0');
   /*@=globs@*/
   		/*@switchbreak@*/ break;
   	case '(':		/* %(...) shell escape */
  @@ -1477,6 +1477,15 @@
   	}
   #endif
   
  +	/* Rewrite "%patchNN ..." as "%patch -P NN ..." and expand. */
  +	if (lastc != NULL && fn > 5 && STREQ("patch", f, 5) && xisdigit(f[5])) {
  +		/*@-internalglobs@*/ /* FIX: verbose may be set */
  +		doFoo(mb, negate, f, (lastc - f), NULL, 0);
  +		/*@=internalglobs@*/
  +		s = lastc;
  +		continue;
  +	}
  +
   	/* XXX necessary but clunky */
   	if (STREQ("basename", f, fn) ||
   	    STREQ("suffix", f, fn) ||
  @@ -1499,19 +1508,6 @@
   	mep = findEntry(mb->mc, f, fn);
   	me = (mep ? *mep : NULL);
   
  -	/* XXX necessary but clunky
  -	 * We have to do this after the findEntry because there may be a
  -	 * macro such as "%patchversion", if it evaluates ignore it!
  -	 */
  -	if (me == NULL && 
  -	     (fn > 5 && STREQ("patch", f, fn >= 5 ? 5 : fn))) {
  -		/*@-internalglobs@*/ /* FIX: verbose may be set */
  -		doFoo(mb, negate, f, fn, g, gn);
  -		/*@=internalglobs@*/
  -		s = se;
  -		continue;
  -	}
  -
   	/* XXX Special processing for flags */
   	if (*f == '-') {
   		if (me)
  @@ .
Received on Sat Jul 14 22:01:40 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.