RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/rpmio/ rpmrepo.c rpmrepo.h rpm/tools/ rpmr...

From: Jeff Johnson <jbj@rpm5.org>
Date: Mon 30 Aug 2010 - 19:48:18 CEST
Message-Id: <20100830174818.C28A2C772C@rpm5.org>
  RPM Package Manager, CVS Repository
  /cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   30-Aug-2010 19:48:18
  Branch: HEAD                             Handle: 2010083017481602

  Modified files:
    rpm                     CHANGES
    rpm/rpmio               rpmrepo.c rpmrepo.h
    rpm/tools               rpmrepo.c

  Log:
    - rpmrepo: move the data structures into the rpmrepo object.

  Summary:
    Revision    Changes     Path
    1.3433      +1  -0      rpm/CHANGES
    2.2         +40 -1      rpm/rpmio/rpmrepo.c
    2.2         +139 -1     rpm/rpmio/rpmrepo.h
    2.26        +78 -60     rpm/tools/rpmrepo.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3432 -r1.3433 CHANGES
  --- rpm/CHANGES	30 Aug 2010 17:17:41 -0000	1.3432
  +++ rpm/CHANGES	30 Aug 2010 17:48:16 -0000	1.3433
  @@ -1,4 +1,5 @@
   5.3.3 -> 5.4a1:
  +    - jbj: rpmrepo: move the data structures into the rpmrepo object.
       - jbj: rpmrepo: stub-in a rpmrepo wrapper to bury the CLI tool in a library.
       - jbj: tests: resurrect rpmrepo test cases in check-rpmrepo target.
       - jbj: rpmrepo: fix: don't segfault processing RPMv3 headers w/o digest.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrepo.c
  ============================================================================
  $ cvs diff -u -r2.1 -r2.2 rpmrepo.c
  --- rpm/rpmio/rpmrepo.c	30 Aug 2010 17:17:42 -0000	2.1
  +++ rpm/rpmio/rpmrepo.c	30 Aug 2010 17:48:18 -0000	2.2
  @@ -4,10 +4,50 @@
   
   #include "system.h"
   
  +#if defined(WITH_SQLITE)
  +#include <sqlite3.h>
  +#ifdef	__LCLINT__
  +/*@-incondefs -redecl @*/
  +extern const char *sqlite3_errmsg(sqlite3 *db)
  +	/*@*/;
  +extern int sqlite3_open(
  +  const char *filename,		   /* Database filename (UTF-8) */
  +  /*@out@*/ sqlite3 **ppDb	   /* OUT: SQLite db handle */
  +)
  +	/*@modifies *ppDb @*/;
  +extern int sqlite3_exec(
  +  sqlite3 *db,			   /* An open database */
  +  const char *sql,		   /* SQL to be evaluted */
  +  int (*callback)(void*,int,char**,char**),  /* Callback function */
  +  void *,			   /* 1st argument to callback */
  +  /*@out@*/ char **errmsg	   /* Error msg written here */
  +)
  +	/*@modifies db, *errmsg @*/;
  +extern int sqlite3_prepare(
  +  sqlite3 *db,			   /* Database handle */
  +  const char *zSql,		   /* SQL statement, UTF-8 encoded */
  +  int nByte,			   /* Maximum length of zSql in bytes. */
  +  /*@out@*/ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
  +  /*@out@*/ const char **pzTail	   /* OUT: Pointer to unused portion of zSql */
  +)
  +	/*@modifies *ppStmt, *pzTail @*/;
  +extern int sqlite3_reset(sqlite3_stmt *pStmt)
  +	/*@modifies pStmt @*/;
  +extern int sqlite3_step(sqlite3_stmt *pStmt)
  +	/*@modifies pStmt @*/;
  +extern int sqlite3_finalize(/*@only@*/ sqlite3_stmt *pStmt)
  +	/*@modifies pStmt @*/;
  +extern int sqlite3_close(sqlite3 * db)
  +	/*@modifies db @*/;
  +/*@=incondefs =redecl @*/
  +#endif	/* __LCLINT__ */
  +#endif	/* WITH_SQLITE */
  +
   #include <rpmiotypes.h>
   #include <rpmio.h>	/* for *Pool methods */
   #include <rpmlog.h>
   #include <rpmurl.h>
  +
   #define	_RPMREPO_INTERNAL
   #include <rpmrepo.h>
   
  @@ -47,7 +87,6 @@
   rpmrepo rpmrepoNew(const char * fn, int flags)
   {
       rpmrepo repo = rpmrepoGetPool(_rpmrepoPool);
  -    int xx;
   
       if (fn)
   	repo->fn = xstrdup(fn);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrepo.h
  ============================================================================
  $ cvs diff -u -r2.1 -r2.2 rpmrepo.h
  --- rpm/rpmio/rpmrepo.h	30 Aug 2010 17:17:42 -0000	2.1
  +++ rpm/rpmio/rpmrepo.h	30 Aug 2010 17:48:18 -0000	2.2
  @@ -5,6 +5,9 @@
    * \file rpmio/rpmrepo.h
    */
   
  +#include <argv.h>
  +#include <mire.h>
  +
   /** \ingroup rpmio
    */
   /*@unchecked@*/
  @@ -13,19 +16,154 @@
   /** \ingroup rpmio
    */
   typedef /*@refcounted@*/ struct rpmrepo_s * rpmrepo;
  +typedef /*@refcounted@*/ struct rpmrfile_s * rpmrfile;
   
   #if defined(_RPMREPO_INTERNAL)
  +/**
  + * Repository metadata file.
  + */
  +struct rpmrfile_s {
  +/*@observer@*/
  +    const char * type;
  +/*@observer@*/
  +    const char * xml_init;
  +/*@observer@*/ /*@relnull@*/
  +    const char * xml_qfmt;
  +/*@observer@*/
  +    const char * xml_fini;
  +/*@observer@*/
  +    const char ** sql_init;
  +/*@observer@*/
  +    const char * sql_qfmt;
  +#ifdef	NOTYET	/* XXX char **?!? */
  +/*@observer@*/
  +    const char ** sql_fini;
  +#endif
  +/*@observer@*/
  +    const char * yaml_init;
  +/*@observer@*/
  +    const char * yaml_qfmt;
  +/*@observer@*/
  +    const char * yaml_fini;
  +/*@observer@*/
  +    const char * Packages_init;
  +/*@observer@*/
  +    const char * Packages_qfmt;
  +/*@observer@*/
  +    const char * Packages_fini;
  +/*@observer@*/
  +    const char * Sources_init;
  +/*@observer@*/
  +    const char * Sources_qfmt;
  +/*@observer@*/
  +    const char * Sources_fini;
  +/*@relnull@*/
  +    FD_t fd;
  +#if defined(WITH_SQLITE)
  +    sqlite3 * sqldb;
  +#endif
  +/*@null@*/
  +    const char * digest;
  +/*@null@*/
  +    const char * Zdigest;
  +    time_t ctime;
  +};
   
  -/** \ingroup rpmio
  +/**
  + * Repository.
    */
  +#define	_RFB(n)	((1U << (n)) | 0x40000000)
  +
  +/**
  + * Bit field enum for copy CLI options.
  + */
  +typedef enum rpmrepoFlags_e {
  +    REPO_FLAGS_NONE		= 0,
  +    REPO_FLAGS_DRYRUN		= _RFB( 0), /*!<    --dryrun ... */
  +    REPO_FLAGS_PRETTY		= _RFB( 1), /*!< -p,--pretty ... */
  +    REPO_FLAGS_DATABASE		= _RFB( 2), /*!< -d,--database ... */
  +    REPO_FLAGS_CHECKTS		= _RFB( 3), /*!< -C,--checkts ... */
  +    REPO_FLAGS_SPLIT		= _RFB( 4), /*!<    --split ... */
  +    REPO_FLAGS_NOFOLLOW		= _RFB( 5), /*!< -S,--skip-symlinks ... */
  +    REPO_FLAGS_UNIQUEMDFN	= _RFB( 6), /*!<    --unique-md-filenames ... */
  +
  +	/* 7-31 unused */
  +} rpmrepoFlags;
  +
  +#define REPO_ISSET(_FLAG) ((repo->flags & ((REPO_FLAGS_##_FLAG) & ~0x40000000)) != REPO_FLAGS_NONE)
  +
   struct rpmrepo_s {
       struct rpmioItem_s _item;	/*!< usage mutex and pool identifier. */
       const char * fn;
  +
  +    rpmrepoFlags flags;
  +
  +    int quiet;
  +    int verbose;
  +/*@null@*/
  +    ARGV_t exclude_patterns;
  +/*@relnull@*/
  +    miRE excludeMire;
  +    int nexcludes;
  +/*@null@*/
  +    ARGV_t include_patterns;
  +/*@relnull@*/
  +    miRE includeMire;
  +    int nincludes;
  +/*@null@*/
  +    const char * basedir;
  +/*@null@*/
  +    const char * baseurl;
  +#ifdef	NOTYET
  +/*@null@*/
  +    const char * groupfile;
  +#endif
  +/*@relnull@*/
  +    const char * outputdir;
  +
  +/*@null@*/
  +    ARGV_t manifests;
  +
  +/*@observer@*/ /*@relnull@*/
  +    const char * tempdir;
  +/*@observer@*/ /*@relnull@*/
  +    const char * finaldir;
  +/*@observer@*/ /*@relnull@*/
  +    const char * olddir;
  +
  +    time_t mdtimestamp;
  +
  +/*@null@*/
  +    void * _ts;
  +/*@null@*/
  +    ARGV_t pkglist;
  +    unsigned current;
  +    unsigned pkgcount;
  +
  +/*@null@*/
  +    ARGV_t directories;
  +    int ftsoptions;
  +    uint32_t pkgalgo;
  +    uint32_t algo;
  +    int compression;
  +/*@observer@*/
  +    const char * markup;
  +/*@observer@*/ /*@null@*/
  +    const char * suffix;
  +/*@observer@*/
  +    const char * wmode;
  +
  +    struct rpmrfile_s primary;
  +    struct rpmrfile_s filelists;
  +    struct rpmrfile_s other;
  +    struct rpmrfile_s repomd;
  +
   #if defined(__LCLINT__)
   /*@refs@*/
       int nrefs;			/*!< (unused) keep splint happy */
   #endif
   };
  +
   #endif	/* _RPMREPO_INTERNAL */
   
   #ifdef __cplusplus
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmrepo.c
  ============================================================================
  $ cvs diff -u -r2.25 -r2.26 rpmrepo.c
  --- rpm/tools/rpmrepo.c	29 Aug 2010 18:51:33 -0000	2.25
  +++ rpm/tools/rpmrepo.c	30 Aug 2010 17:48:18 -0000	2.26
  @@ -40,16 +40,17 @@
   extern int sqlite3_close(sqlite3 * db)
   	/*@modifies db @*/;
   /*@=incondefs =redecl @*/
  -#endif
  -#endif
  +#endif	/* __LCLINT__ */
  +#endif	/* WITH_SQLITE */
   
   #include <rpmio_internal.h>	/* XXX fdInitDigest() et al */
   #include <rpmdir.h>
   #include <fts.h>
  -#include <argv.h>
  -#include <mire.h>
   #include <poptIO.h>
   
  +#define _RPMREPO_INTERNAL
  +#include <rpmrepo.h>
  +
   #include <rpmtypes.h>
   #include <rpmtag.h>
   #include <pkgio.h>
  @@ -62,9 +63,8 @@
   
   /*==============================================================*/
   
  -/*@unchecked@*/
  -static int _repo_debug;
   
  +#ifdef	DYING
   typedef struct rpmrepo_s * rpmrepo;
   typedef struct rpmrfile_s * rpmrfile;
   
  @@ -121,10 +121,32 @@
   /**
    * Repository.
    */
  +#define	_KFB(n)	(1U << (n))
  +#define	_RFB(n)	(_KFB(n) | 0x40000000)
  +
  +/**
  + * Bit field enum for copy CLI options.
  + */
  +typedef enum rpmrepoFlags_e {
  +    REPO_FLAGS_NONE		= 0,
  +    REPO_FLAGS_DRYRUN		= _RFB( 0), /*!<    --dryrun ... */
  +    REPO_FLAGS_PRETTY		= _RFB( 1), /*!< -p,--pretty ... */
  +    REPO_FLAGS_DATABASE		= _RFB( 2), /*!< -d,--database ... */
  +    REPO_FLAGS_CHECKTS		= _RFB( 3), /*!< -C,--checkts ... */
  +    REPO_FLAGS_SPLIT		= _RFB( 4), /*!<    --split ... */
  +    REPO_FLAGS_NOFOLLOW		= _RFB( 5), /*!< -S,--skip-symlinks ... */
  +    REPO_FLAGS_UNIQUEMDFN	= _RFB( 6), /*!<    --unique-md-filenames ... */
  +
  +	/* 7-31 unused */
  +} rpmrepoFlags;
  +
  +#define REPO_ISSET(_FLAG) ((repo->flags & ((REPO_FLAGS_##_FLAG) & ~0x40000000)) != REPO_FLAGS_NONE)
  +
   struct rpmrepo_s {
  +    rpmrepoFlags flags;
  +
       int quiet;
       int verbose;
  -    int dryrun;
   /*@null@*/
       ARGV_t exclude_patterns;
   /*@relnull@*/
  @@ -143,16 +165,9 @@
   /*@null@*/
       const char * groupfile;
   #endif
  -    int split;
  -#if defined(WITH_SQLITE)
  -    int database;
  -#endif
  -    int pretty;
  -    int checkts;
   /*@relnull@*/
       const char * outputdir;
   
  -    int nofollow;
   /*@null@*/
       ARGV_t manifests;
   
  @@ -165,8 +180,6 @@
   
       time_t mdtimestamp;
   
  -    int uniquemdfilenames;
  -
   /*@null@*/
       rpmts ts;
   /*@null@*/
  @@ -193,6 +206,7 @@
       struct rpmrfile_s repomd;
   
   };
  +#endif	/* DYING */
   
   /*@unchecked@*/ /*@observer@*/
   static const char primary_xml_init[] =
  @@ -420,10 +434,8 @@
   /*@-fullinitblock@*/
   /*@unchecked@*/
   static struct rpmrepo_s __rpmrepo = {
  -    .pretty	= 1,
  -#if defined(WITH_SQLITE)
  -    .database	= 0,
  -#endif
  +    .flags	= REPO_FLAGS_PRETTY,
  +
       .tempdir	= ".repodata",
       .finaldir	= "repodata",
       .olddir	= ".olddata",
  @@ -725,7 +737,7 @@
   		    repo_error(0, _("Path must be writable: %s"), fn);
   		    rc = 1;
   		} else
  -		if (repo->checkts && st->st_ctime > repo->mdtimestamp)
  +		if (REPO_ISSET(CHECKTS) && st->st_ctime > repo->mdtimestamp)
   		    repo->mdtimestamp = st->st_ctime;
   	    }
   	    fn = _free(fn);
  @@ -735,7 +747,7 @@
   
   #ifdef	NOTYET		/* XXX repo->package_dir needs to go away. */
       if (repo->groupfile != NULL) {
  -	if (repo->split || repo->groupfile[0] != '/') {
  +	if (REPO_ISSET(SPLIT) || repo->groupfile[0] != '/') {
   	    fn = rpmGetPath(repo->package_dir, "/", repo->groupfile, NULL);
   	    repo->groupfile = _free(repo->groupfile);
   	    repo->groupfile = fn;
  @@ -813,7 +825,7 @@
   	    continue;
   	    /*@notreached@*/ /*@switchbreak@*/ break;
   	case FTS_SL:
  -	    if (repo->nofollow)
  +	    if (REPO_ISSET(NOFOLLOW))
   		continue;
   	    /* XXX todo: fuss with symlinks */
   	    /*@notreached@*/ /*@switchbreak@*/ break;
  @@ -827,7 +839,7 @@
   
       (void) Fts_close(t);
   
  -if (_repo_debug)
  +if (_rpmrepo_debug)
   argvPrint("pkglist", pkglist, NULL);
   
       return pkglist;
  @@ -844,7 +856,7 @@
   {
       int rc = 0;
   
  -    if (repo->checkts) {
  +    if (REPO_ISSET(CHECKTS)) {
   	const char ** pkg;
   
   	if (repo->pkglist != NULL)
  @@ -898,10 +910,11 @@
       int rc = 0;
   
       if (fd != NULL) {
  -	if (repo->ts != NULL) {
  -	    (void) rpmswAdd(rpmtsOp(repo->ts, RPMTS_OP_UNCOMPRESS),
  +	rpmts ts = repo->_ts;
  +	if (ts != NULL) {
  +	    (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_UNCOMPRESS),
   			fdstat_op(fd, FDSTAT_READ));
  -	    (void) rpmswAdd(rpmtsOp(repo->ts, RPMTS_OP_DIGEST),
  +	    (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DIGEST),
   			fdstat_op(fd, FDSTAT_DIGEST));
   	}
   	rc = Fclose(fd);
  @@ -953,7 +966,7 @@
       fn = _free(fn);
   
   #if defined(WITH_SQLITE)
  -    if (repo->database) {
  +    if (REPO_ISSET(DATABASE)) {
   	const char ** stmt;
   	int xx;
   	fn = rpmGetPath(repo->outputdir, "/", repo->tempdir, "/",
  @@ -989,6 +1002,7 @@
       Header h = NULL;
   
       if (fd != NULL) {
  +	rpmts ts = repo->_ts;
   	uint32_t algo = repo->pkgalgo;
   	rpmRC rpmrc;
   
  @@ -996,7 +1010,7 @@
   	    fdInitDigest(fd, algo, 0);
   
   	/* XXX what if path needs expansion? */
  -	rpmrc = rpmReadPackageFile(repo->ts, fd, path, &h);
  +	rpmrc = rpmReadPackageFile(ts, fd, path, &h);
   	if (algo != PGPHASHALGO_NONE) {
   	    char buffer[32 * BUFSIZ];
   	    size_t nb = sizeof(buffer);
  @@ -1022,7 +1036,7 @@
   	case RPMRC_NOTFOUND:
   	case RPMRC_FAIL:
   	default:
  -	    (void)headerFree(h);
  +	    (void) headerFree(h);
   	    h = NULL;
   	    break;
   	case RPMRC_NOTTRUSTED:
  @@ -1064,7 +1078,7 @@
   	/*@globals fileSystem @*/
   	/*@modifies fileSystem @*/
   {
  -    if (rc != SQLITE_OK || _repo_debug)
  +    if (rc != SQLITE_OK || _rpmrepo_debug)
   	repo_error(0, "sqlite3_%s(%s): %s", msg, rfile->type,
   		sqlite3_errmsg(rfile->sqldb));
       return rc;
  @@ -1204,7 +1218,7 @@
       }
   
   #if defined(WITH_SQLITE)
  -    if (repo->database) {
  +    if (REPO_ISSET(DATABASE)) {
   	if (rfileSQLWrite(rfile, rfileHeaderSprintfHack(h, rfile->sql_qfmt)))
   	    rc = 1;
       }
  @@ -1300,7 +1314,8 @@
   	if (st->st_size > 0)
   	    mapped = mmap(NULL, st->st_size, PROT_READ, MAP_SHARED, Fileno(fd), 0);
   	if (mapped != (void *)-1) {
  -	    rpmop op = rpmtsOp(repo->ts, RPMTS_OP_DIGEST);
  +	    rpmts ts = repo->_ts;
  +	    rpmop op = rpmtsOp(ts, RPMTS_OP_DIGEST);
   	    rpmtime_t tstamp = rpmswEnter(op, 0);
   	    DIGEST_CTX ctx = rpmDigestInit(repo->algo, RPMDIGEST_NONE);
   	    xx = rpmDigestUpdate(ctx, mapped, st->st_size);
  @@ -1367,7 +1382,7 @@
       (void) repoRfileDigest(repo, rfile, &rfile->Zdigest);
   
   #if defined(WITH_SQLITE)
  -    if (repo->database && rfile->sqldb != NULL) {
  +    if (REPO_ISSET(DATABASE) && rfile->sqldb != NULL) {
   	const char *dbfn = rpmGetPath(repo->outputdir, "/", repo->tempdir, "/",
   		rfile->type, ".sqlite", NULL);
   	int xx;
  @@ -1565,7 +1580,7 @@
   
           repoid = "garbageid";
   
  -        if (repo->database) {
  +        if (REPO_ISSET(DATABASE)) {
               if (!repo->quiet) repo_error(0, _("Generating sqlite DBs"));
               try:
                   dbversion = str(sqlitecachec.DBVERSION)
  @@ -1590,7 +1605,7 @@
               db_csums = {}
               db_compressed_sums = {}
   
  -            if (repo->database) {
  +            if (REPO_ISSET(repo)) {
                   if (repo->verbose) {
   		    time_t now = time(NULL);
                       repo_error(0, _("Starting %s db creation: %s"),
  @@ -1628,7 +1643,7 @@
   		    resultpath = _free(resultpath);
   		}
   
  -                if (repo->uniquemdfilenames) {
  +                if (REPO_ISSET(UNIQUEMDFN)) {
                       const char * csum_result_compressed =
   			rpmGetPath(repo->outputdir, "/", repo->tempdir, "/",
   				db_compressed_sums[*typep], "-", *typep, ".sqlite.bz2", NULL);
  @@ -1675,7 +1690,7 @@
               location = data.newChild(None, 'location', None)
               if (repo->baseurl != NULL)
                   location.newProp('xml:base', repo->baseurl)
  -            if (repo->uniquemdfilenames) {
  +            if (REPO_ISSET(UNIQUEMDFN)) {
                   orig_file = repoGetPath(repo, repo->tempdir, *typep, strcmp(*typep, "repomd"));
                   res_file = rpmExpand(csum, "-", *typep,
   			(repo->markup ? repo->markup : ""),
  @@ -1692,7 +1707,7 @@
   	}
     }
   
  -        if (!repo->quiet && repo->database)
  +        if (!repo->quiet && REPO_ISSET(DATABASE))
   	    repo_error(0, _("Sqlite DBs complete"));
   
           if (repo->groupfile != NULL) {
  @@ -1887,14 +1902,14 @@
           repoArgCallback, 0, NULL, NULL },
   /*@=type@*/
   
  - { "repodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_repo_debug, -1,
  + { "repodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmrepo_debug, -1,
   	N_("debug repo handling"), NULL },
   
    { "quiet", 'q', POPT_ARG_VAL,			&__rpmrepo.quiet, 0,
   	N_("output nothing except for serious errors"), NULL },
    { "verbose", 'v', 0,				NULL, (int)'v',
   	N_("output more debugging info."), NULL },
  - { "dryrun", '\0', POPT_ARG_VAL,		&__rpmrepo.dryrun, 1,
  + { "dryrun", '\0', POPT_BIT_SET,	&__rpmrepo.flags, REPO_FLAGS_DRYRUN,
   	N_("sanity check arguments, don't create metadata"), NULL },
    { "excludes", 'x', POPT_ARG_ARGV,		&__rpmrepo.exclude_patterns, 0,
   	N_("glob PATTERN(s) to exclude"), N_("PATTERN") },
  @@ -1908,23 +1923,21 @@
    { "groupfile", 'g', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN,	&__rpmrepo.groupfile, 0,
   	N_("path to groupfile to include in metadata"), N_("FILE") },
   #endif
  - { "pretty", 'p', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN,		&__rpmrepo.pretty, 1,
  + { "pretty", 'p', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,		&__rpmrepo.flags, REPO_FLAGS_PRETTY,
   	N_("make sure all xml generated is formatted"), NULL },
  - { "checkts", 'C', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN,	&__rpmrepo.checkts, 1,
  + { "checkts", 'C', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,	&__rpmrepo.flags, REPO_FLAGS_CHECKTS,
   	N_("check timestamps on files vs the metadata to see if we need to update"), NULL },
  -#if defined(WITH_SQLITE)
  - { "database", 'd', POPT_ARG_VAL,		&__rpmrepo.database, 1,
  + { "database", 'd', POPT_BIT_SET,		&__rpmrepo.flags, REPO_FLAGS_DATABASE,
   	N_("create sqlite3 database files"), NULL },
  -#endif
  - { "split", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN,		&__rpmrepo.split, 1,
  + { "split", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,		&__rpmrepo.flags, REPO_FLAGS_SPLIT,
   	N_("generate split media"), NULL },
    { "pkglist", 'l', POPT_ARG_ARGV|POPT_ARGFLAG_DOC_HIDDEN,	&__rpmrepo.manifests, 0,
   	N_("use only the files listed in this file from the directory specified"), N_("FILE") },
    { "outputdir", 'o', POPT_ARG_STRING,		&__rpmrepo.outputdir, 0,
   	N_("<dir> = optional directory to output to"), N_("DIR") },
  - { "skip-symlinks", 'S', POPT_ARG_VAL,		&__rpmrepo.nofollow, 1,
  + { "skip-symlinks", 'S', POPT_BIT_SET,		&__rpmrepo.flags, REPO_FLAGS_NOFOLLOW,
   	N_("ignore symlinks of packages"), NULL },
  - { "unique-md-filenames", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.uniquemdfilenames, 1,
  + { "unique-md-filenames", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &__rpmrepo.flags, REPO_FLAGS_UNIQUEMDFN,
   	N_("include the file's checksum in the filename, helps with proxies"), NULL },
   
    { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioFtsPoptTable, 0,
  @@ -2070,7 +2083,7 @@
   	rpath = _free(rpath);
       }
   
  -if (_repo_debug || repo->dryrun)
  +if (_rpmrepo_debug || REPO_ISSET(DRYRUN))
   argvPrint("repo->directories", repo->directories, NULL);
   
   #ifdef	NOTYET
  @@ -2088,7 +2101,7 @@
   	}
       }
   
  -    if (repo->split && repo->checkts)
  +    if (REPO_ISSET(SPLIT) && REPO_ISSET(CHECKTS))
   	repo_error(1, _("--split and --checkts options are mutually exclusive"));
   
   #ifdef	NOTYET
  @@ -2124,24 +2137,26 @@
       /* XXX todo: check for duplicates in repo->pkglist? */
       xx = argvSort(repo->pkglist, NULL);
   
  -if (_repo_debug || repo->dryrun)
  +if (_rpmrepo_debug || REPO_ISSET(DRYRUN))
   argvPrint("repo->pkglist", repo->pkglist, NULL);
   
       repo->pkgcount = argvCount(repo->pkglist);
   
       /* XXX enable --stats using transaction set. */
  -    _rpmts_stats = _rpmsw_stats;
  -    repo->ts = rpmtsCreate();
  +    {	rpmts ts = repo->_ts;
  +	_rpmts_stats = _rpmsw_stats;
  +	repo->_ts = ts = rpmtsCreate();
   
       /* XXX todo wire up usual rpm CLI options. hotwire --nosignature for now */
  -    (void) rpmtsSetVSFlags(repo->ts, _RPMVSF_NOSIGNATURES);
  +	(void) rpmtsSetVSFlags(ts, _RPMVSF_NOSIGNATURES);
  +    }
   
       rc = repoTestSetupDirs(repo);
   	
  -    if (rc || repo->dryrun)
  +    if (rc || REPO_ISSET(DRYRUN))
   	goto exit;
   
  -    if (!repo->split) {
  +    if (!REPO_ISSET(SPLIT)) {
   	rc = repoCheckTimeStamps(repo);
   	if (rc == 0) {
   	    fprintf(stdout, _("repo is up to date\n"));
  @@ -2157,8 +2172,11 @@
   	goto exit;
   
   exit:
  -    (void)rpmtsFree(repo->ts); 
  -    repo->ts = NULL;
  +    {	rpmts ts = repo->_ts;
  +	(void) rpmtsFree(ts); 
  +	repo->_ts = NULL;
  +    }
  +
       repo->primary.digest = _free(repo->primary.digest);
       repo->primary.Zdigest = _free(repo->primary.Zdigest);
       repo->filelists.digest = _free(repo->filelists.digest);
  @@ .
Received on Mon Aug 30 19:48:18 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.