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:17:43
Branch: HEAD Handle: 2010083017174101
Added files:
rpm/rpmio rpmrepo.c rpmrepo.h
Modified files:
rpm CHANGES
rpm/rpmio Makefile.am librpmio.vers poptIO.c rpmio.c
Log:
- rpmrepo: stub-in a rpmrepo wrapper to bury the CLI tool in a
library.
Summary:
Revision Changes Path
1.3432 +1 -0 rpm/CHANGES
1.284 +2 -2 rpm/rpmio/Makefile.am
2.191 +2 -0 rpm/rpmio/librpmio.vers
1.92 +3 -0 rpm/rpmio/poptIO.c
1.228 +2 -0 rpm/rpmio/rpmio.c
2.1 +56 -0 rpm/rpmio/rpmrepo.c
2.1 +84 -0 rpm/rpmio/rpmrepo.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.3431 -r1.3432 CHANGES
--- rpm/CHANGES 29 Aug 2010 19:15:02 -0000 1.3431
+++ rpm/CHANGES 30 Aug 2010 17:17:41 -0000 1.3432
@@ -1,4 +1,5 @@
5.3.3 -> 5.4a1:
+ - 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.
- jbj: rpmrepo: rescusitate .olddata cleanup iff using sqlite from db-5.0.26.
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/Makefile.am
============================================================================
$ cvs diff -u -r1.283 -r1.284 Makefile.am
--- rpm/rpmio/Makefile.am 12 Aug 2010 13:39:55 -0000 1.283
+++ rpm/rpmio/Makefile.am 30 Aug 2010 17:17:42 -0000 1.284
@@ -84,7 +84,7 @@
rpmcdsa.h rpmcudf.h rpmcvs.h rpmdav.h rpmdir.h rpmficl.h rpmgc.h rpmgit.h rpmhash.h \
rpmhkp.h rpmhook.h rpmio_internal.h rpmjs.h rpmjsio.h rpmkeyring.h \
rpmku.h rpmltc.h rpmlua.h rpmmg.h rpmnix.h rpmnss.h \
- rpmperl.h rpmpython.h rpmruby.h rpmsm.h rpmsp.h \
+ rpmperl.h rpmpython.h rpmrepo.h rpmruby.h rpmsm.h rpmsp.h \
rpmsq.h rpmsql.h rpmsquirrel.h rpmssl.h rpmsvn.h rpmsx.h rpmsyck.h \
rpmtcl.h rpmtpm.h rpmurl.h rpmuuid.h rpmxar.h rpmz.h rpmzq.h \
tar.h ugid.h rpmio-stub.h
@@ -103,7 +103,7 @@
rpmhash.c rpmhkp.c rpmhook.c rpmio.c rpmiob.c rpmio-stub.c \
rpmjs.c rpmjsio.c rpmkeyring.c rpmku.c \
rpmlog.c rpmltc.c rpmlua.c rpmmalloc.c rpmmg.c rpmnix.c rpmnss.c \
- rpmperl.c rpmpgp.c rpmpython.c rpmrpc.c rpmruby.c rpmsm.c rpmsp.c \
+ rpmperl.c rpmpgp.c rpmpython.c rpmrepo.c rpmrpc.c rpmruby.c rpmsm.c rpmsp.c \
rpmsq.c rpmsql.c rpmsquirrel.c rpmssl.c rpmsvn.c rpmsw.c rpmsx.c \
rpmsyck.c rpmtcl.c rpmtpm.c rpmuuid.c rpmxar.c rpmzlog.c rpmzq.c \
strcasecmp.c strtolocale.c tar.c url.c ugid.c xzdio.c yarn.c
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/librpmio.vers
============================================================================
$ cvs diff -u -r2.190 -r2.191 librpmio.vers
--- rpm/rpmio/librpmio.vers 13 Aug 2010 21:34:03 -0000 2.190
+++ rpm/rpmio/librpmio.vers 30 Aug 2010 17:17:42 -0000 2.191
@@ -541,6 +541,8 @@
rpmpythonNew;
rpmpythonRun;
rpmpythonRunFile;
+ _rpmrepo_debug;
+ rpmrepoNew;
_rpmrubyI;
_rpmrubyPool;
_rpmruby_debug;
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/poptIO.c
============================================================================
$ cvs diff -u -r1.91 -r1.92 poptIO.c
--- rpm/rpmio/poptIO.c 12 Aug 2010 13:39:55 -0000 1.91
+++ rpm/rpmio/poptIO.c 30 Aug 2010 17:17:42 -0000 1.92
@@ -40,6 +40,7 @@
#include <rpmnix.h>
#include <rpmperl.h>
#include <rpmpython.h>
+#include <rpmrepo.h>
#include <rpmruby.h>
#include <rpmsql.h>
#include <rpmsquirrel.h>
@@ -632,6 +633,8 @@
N_("Debug depsolver wrappers "), NULL},
{ "rpmcvsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmcvs_debug, -1,
N_("Debug CVS wrappers "), NULL},
+ { "rpmrepodebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmrepo_debug, -1,
+ N_("Debug repository wrappers "), NULL},
{ "rpmsvndebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmsvn_debug, -1,
N_("Debug Subversion wrappers "), NULL},
{ "rpmtpmdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmtpm_debug, -1,
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmio.c
============================================================================
$ cvs diff -u -r1.227 -r1.228 rpmio.c
--- rpm/rpmio/rpmio.c 12 Aug 2010 13:39:55 -0000 1.227
+++ rpm/rpmio/rpmio.c 30 Aug 2010 17:17:42 -0000 1.228
@@ -3222,6 +3222,7 @@
extern rpmioPool _rpmasnPool;
extern rpmioPool _rpmbagPool;
extern rpmioPool _rpmcvsPool;
+ extern rpmioPool _rpmrepoPool;
extern rpmioPool _rpmsvnPool;
extern rpmioPool _rpmtpmPool;
@@ -3280,6 +3281,7 @@
_rpmasnPool = rpmioFreePool(_rpmasnPool);
_rpmbagPool = rpmioFreePool(_rpmbagPool);
_rpmcvsPool = rpmioFreePool(_rpmcvsPool);
+ _rpmrepoPool = rpmioFreePool(_rpmrepoPool);
_rpmsvnPool = rpmioFreePool(_rpmsvnPool);
_rpmtpmPool = rpmioFreePool(_rpmtpmPool);
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmrepo.c
============================================================================
$ cvs diff -u -r0 -r2.1 rpmrepo.c
--- /dev/null 2010-08-30 19:16:21.000000000 +0200
+++ rpmrepo.c 2010-08-30 19:17:42.939028270 +0200
@@ -0,0 +1,56 @@
+/** \ingroup rpmio
+ * \file rpmio/rpmrepo.c
+ */
+
+#include "system.h"
+
+#include <rpmiotypes.h>
+#include <rpmio.h> /* for *Pool methods */
+#include <rpmlog.h>
+#include <rpmurl.h>
+#define _RPMREPO_INTERNAL
+#include <rpmrepo.h>
+
+#include "debug.h"
+
+/*@unchecked@*/
+int _rpmrepo_debug = 0;
+
+static void rpmrepoFini(void * _repo)
+ /*@globals fileSystem @*/
+ /*@modifies *_repo, fileSystem @*/
+{
+ rpmrepo repo = _repo;
+
+ repo->fn = _free(repo->fn);
+}
+
+/*@unchecked@*/ /*@only@*/ /*@null@*/
+rpmioPool _rpmrepoPool = NULL;
+
+static rpmrepo rpmrepoGetPool(/*@null@*/ rpmioPool pool)
+ /*@globals _rpmrepoPool, fileSystem @*/
+ /*@modifies pool, _rpmrepoPool, fileSystem @*/
+{
+ rpmrepo repo;
+
+ if (_rpmrepoPool == NULL) {
+ _rpmrepoPool = rpmioNewPool("repo", sizeof(*repo), -1, _rpmrepo_debug,
+ NULL, NULL, rpmrepoFini);
+ pool = _rpmrepoPool;
+ }
+ repo = (rpmrepo) rpmioGetPool(pool, sizeof(*repo));
+ memset(((char *)repo)+sizeof(repo->_item), 0, sizeof(*repo)-sizeof(repo->_item));
+ return repo;
+}
+
+rpmrepo rpmrepoNew(const char * fn, int flags)
+{
+ rpmrepo repo = rpmrepoGetPool(_rpmrepoPool);
+ int xx;
+
+ if (fn)
+ repo->fn = xstrdup(fn);
+
+ return rpmrepoLink(repo);
+}
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmrepo.h
============================================================================
$ cvs diff -u -r0 -r2.1 rpmrepo.h
--- /dev/null 2010-08-30 19:16:21.000000000 +0200
+++ rpmrepo.h 2010-08-30 19:17:42.969029878 +0200
@@ -0,0 +1,84 @@
+#ifndef H_RPMREPO
+#define H_RPMREPO
+
+/** \ingroup rpmio
+ * \file rpmio/rpmrepo.h
+ */
+
+/** \ingroup rpmio
+ */
+/*@unchecked@*/
+extern int _rpmrepo_debug;
+
+/** \ingroup rpmio
+ */
+typedef /*@refcounted@*/ struct rpmrepo_s * rpmrepo;
+
+#if defined(_RPMREPO_INTERNAL)
+
+/** \ingroup rpmio
+ */
+struct rpmrepo_s {
+ struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */
+ const char * fn;
+#if defined(__LCLINT__)
+/*@refs@*/
+ int nrefs; /*!< (unused) keep splint happy */
+#endif
+};
+#endif /* _RPMREPO_INTERNAL */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Unreference a repo wrapper instance.
+ * @param repo repo wrapper
+ * @return NULL on last dereference
+ */
+/*@unused@*/ /*@null@*/
+rpmrepo rpmrepoUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmrepo repo)
+ /*@modifies repo @*/;
+#define rpmrepoUnlink(_repo) \
+ ((rpmrepo)rpmioUnlinkPoolItem((rpmioItem)(_repo), __FUNCTION__, __FILE__, __LINE__))
+
+/**
+ * Reference a repo wrapper instance.
+ * @param repo repo wrapper
+ * @return new repo wrapper reference
+ */
+/*@unused@*/ /*@newref@*/ /*@null@*/
+rpmrepo rpmrepoLink (/*@null@*/ rpmrepo repo)
+ /*@modifies repo @*/;
+#define rpmrepoLink(_repo) \
+ ((rpmrepo)rpmioLinkPoolItem((rpmioItem)(_repo), __FUNCTION__, __FILE__, __LINE__))
+
+/**
+ * Destroy a repo wrapper.
+ * @param repo repo wrapper
+ * @return NULL on last dereference
+ */
+/*@null@*/
+rpmrepo rpmrepoFree(/*@killref@*/ /*@null@*/rpmrepo repo)
+ /*@globals fileSystem @*/
+ /*@modifies repo, fileSystem @*/;
+#define rpmrepoFree(_repo) \
+ ((rpmrepo)rpmioFreePoolItem((rpmioItem)(_repo), __FUNCTION__, __FILE__, __LINE__))
+
+/**
+ * Create and load a repo wrapper.
+ * @param fn repo file
+ * @param flags repo flags
+ * @return new repo wrapper
+ */
+/*@newref@*/ /*@null@*/
+rpmrepo rpmrepoNew(const char * fn, int flags)
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H_RPMREPO */
@@ .
Received on Mon Aug 30 19:17:43 2010