RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/rpmio/ Makefile.am macro.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Fri 22 Jun 2007 - 04:05:04 CEST
Message-Id: <20070622020504.252D13484EC@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-Jun-2007 04:05:04
  Branch: HEAD                             Handle: 2007062203050300

  Modified files:
    rpm/rpmio               Makefile.am macro.c

  Log:
    resurrect standalone macro tester.

  Summary:
    Revision    Changes     Path
    1.82        +7  -2      rpm/rpmio/Makefile.am
    2.119       +22 -4      rpm/rpmio/macro.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.81 -r1.82 Makefile.am
  --- rpm/rpmio/Makefile.am	20 Jun 2007 21:10:22 -0000	1.81
  +++ rpm/rpmio/Makefile.am	22 Jun 2007 02:05:03 -0000	1.82
  @@ -6,7 +6,7 @@
   
   EXTRA_DIST = tax.c tdir.c tficl.c tfts.c tget.c thkp.c tput.c tglob.c tinv.c tkey.c trpmio.c lookup3.c librpmio.vers
   
  -EXTRA_PROGRAMS = tax tdir tfts tget thkp tput tglob tinv tkey trpmio tsw dumpasn1 lookup3
  +EXTRA_PROGRAMS = tax tdir tfts tget thkp tmacro tput tglob tinv tkey trpmio tsw dumpasn1 lookup3
   
   INCLUDES = -I. \
   	-I$(top_srcdir) \
  @@ -74,11 +74,16 @@
   thkp_LDFLAGS = @LDFLAGS_STATIC@
   thkp_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   
  +tmacro_SOURCES = 
  +tmacro_LDFLAGS = # @LDFLAGS_STATIC@
  +tmacro_LDADD = tmacro.o # librpmio.la $(top_builddir)/popt/libpopt.la
  +tmacro.o:  macro.c
  +	$(COMPILE) -DDEBUG_MACROS -DEVAL_MACROS -o $@ -c $<
  +
   tput_SOURCES = tput.c
   tput_LDFLAGS = @LDFLAGS_STATIC@
   tput_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
   
  -
   tglob_SOURCES = tglob.c
   tglob_LDFLAGS = @LDFLAGS_STATIC@
   tglob_LDADD = librpmio.la $(top_builddir)/popt/libpopt.la
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/macro.c
  ============================================================================
  $ cvs diff -u -r2.118 -r2.119 macro.c
  --- rpm/rpmio/macro.c	17 Jun 2007 14:49:02 -0000	2.118
  +++ rpm/rpmio/macro.c	22 Jun 2007 02:05:03 -0000	2.119
  @@ -21,13 +21,21 @@
   #include <stdio.h>
   #include <stdlib.h>
   #include <string.h>
  +#include <ctype.h>
   #define rpmError fprintf
  +#define	rpmIsVerbose()	(0)
   #define RPMERR_BADSPEC stderr
   #undef	_
   #define	_(x)	x
   
  -#define	vmefail()		(exit(1), NULL)
  -#define	urlPath(_xr, _r)	*(_r) = (_xr)
  +#define	vmefail(_nb)		(exit(1), NULL)
  +#define	URL_IS_DASH		1
  +#define	URL_IS_PATH		2
  +#define	urlPath(_xr, _r)	(*(_r) = (_xr), URL_IS_PATH)
  +#define	xisalnum(_c)		isalnum(_c)
  +#define	xisalpha(_c)		isalpha(_c)
  +#define	xisdigit(_c)		isdigit(_c)
  +#
   
   typedef	FILE * FD_t;
   #define Fopen(_path, _fmode)	fopen(_path, "r");
  @@ -1148,7 +1156,8 @@
   	else
   	    b = (rpmIsVerbose() ? buf : NULL);
       } else if (STREQ("url2path", f, fn) || STREQ("u2p", f, fn)) {
  -	(void)urlPath(buf, (const char **)&b);
  +	int ut = urlPath(buf, (const char **)&b);
  +	ut = ut;	/* XXX quiet gcc */
   /*@-branchstate@*/
   	if (*b == '\0') b = "/";
   /*@=branchstate@*/
  @@ -1577,6 +1586,7 @@
       return rc;
   }
   
  +#if !defined(DEBUG_MACROS)
   /* =============================================================== */
   /* XXX dupe'd to avoid change in linkage conventions. */
   
  @@ -1841,6 +1851,7 @@
   /*@=branchstate@*/
       return rc;
   }
  +#endif	/* !defined(DEBUG_MACROS) */
   
   /* =============================================================== */
   
  @@ -2032,9 +2043,16 @@
   	/* Glob expand the macro file path element, expanding ~ to $HOME. */
   	ac = 0;
   	av = NULL;
  +#if defined(DEBUG_MACROS)
  +	ac = 1;
  +	av = xmalloc((ac + 1) * sizeof(*av));
  +	av[0] = strdup(m);
  +	av[1] = NULL;
  +#else
   	i = rpmGlob(m, &ac, &av);
           if (i != 0)
   	    continue;
  +#endif
   
   	/* Read macros from each file. */
   
  @@ -2414,7 +2432,7 @@
   
   #if defined(EVAL_MACROS)
   
  -char *rpmMacrofiles = "/usr/lib/rpm/macros:/etc/rpm/macros:~/.rpmmacros";
  +const char *rpmMacrofiles = MACROFILES;
   
   int
   main(int argc, char *argv[])
  @@ .
Received on Fri Jun 22 04:05:04 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.