-/** \ingroup python
+/** \ingroup py_c
* \file python/_rpmdb.c
*/
#define PY_BSDDB_VERSION "3.4.2"
-static char *rcs_id = "$Id: _rpmdb.c,v 1.7 2002/11/08 22:23:37 jbj Exp $";
+static char *rcs_id = "$Id: _rpmdb.c,v 1.8 2003/04/17 17:17:27 jbj Exp $";
#ifdef WITH_THREAD
-/** \ingroup python
+/** \ingroup py_c
* \file python/header-py.c
*/
#include "debug.h"
/** \ingroup python
+ * \class Rpm
+ * \brief START HERE / RPM base module for the Python API
+ *
+ * The rpm base module provides the main starting point for
+ * accessing RPM from Python. For most usage, call
+ * the TransactionSet method to get a transaction set (rpmts).
+ *
+ * For example:
+ * \code
+ * import rpm
+ *
+ * ts = rpm.TransactionSet()
+ * \endcode
+ *
+ * The transaction set will open the RPM database as needed, so
+ * in most cases, you do not need to explicitly open the
+ * database. The transaction set is the workhorse of RPM.
+ *
+ * You can open another RPM database, such as one that holds
+ * all packages for a given Linux distribution, to provide
+ * packages used to solve dependencies. To do this, use
+ * the following code:
+ *
+ * \code
+ * rpm.addMacro('_dbpath', '/path/to/alternate/database')
+ * solvets = rpm.TransactionSet()
+ * solvets.openDB()
+ * rpm.delMacro('_dbpath')
+ *
+ * # Open default database
+ * ts = rpm.TransactionSet()
+ * \endcode
+ *
+ * This code gives you access to two RPM databases through
+ * two transaction sets (rpmts): ts is a transaction set
+ * associated with the default RPM database and solvets
+ * is a transaction set tied to an alternate database, which
+ * is very useful for resolving dependencies.
+ *
+ * The rpm methods used here are:
+ *
+ * - addMacro(macro, value)
+ * @param macro Name of macro to add
+ * @param value Value for the macro
+ *
+ * - delMacro(macro)
+ * @param macro Name of macro to delete
+ *
+ */
+
+/** \ingroup python
* \class Rpmhdr
* \brief A python header object represents an RPM package header.
- *
+ *
* All RPM packages have headers that provide metadata for the package.
* Header objects can be returned by database queries or loaded from a
* binary package on disk.
- *
+ *
* The ts.hdrFromFdno() function returns the package header from a
* package on disk, verifying package signatures and digests of the
* package while reading.
* else:
* print "header is from a binary package"
* \endcode
- *
+ *
* The Python interface to the header data is quite elegant. It
* presents the data in a dictionary form. We'll take the header we
* just loaded and access the data within it:
*/
/*@{*/
-/** \ingroup python
+/** \ingroup py_c
*/
struct hdrObject_s {
PyObject_HEAD
return 0;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * hdrKeyList(hdrObject * s, PyObject * args)
/*@*/
return list;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * hdrUnload(hdrObject * s, PyObject * args, PyObject *keywords)
/*@*/
static char *kwlist[] = { "legacyHeader", NULL};
if (!PyArg_ParseTupleAndKeywords(args, keywords, "|i", kwlist, &legacy))
- return NULL;
+ return NULL;
h = headerLink(s->h);
/* XXX this legacy switch is a hack, needs to be removed. */
return rc;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * hdrExpandFilelist(hdrObject * s, PyObject * args)
/*@*/
return Py_None;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * hdrCompressFilelist(hdrObject * s, PyObject * args)
/*@*/
}
/* make a header with _all_ the tags we need */
-/** \ingroup python
+/** \ingroup py_c
*/
static void mungeFilelist(Header h)
/*@*/
|| !headerIsEntry (h, RPMTAG_DIRNAMES)
|| !headerIsEntry (h, RPMTAG_DIRINDEXES))
compressFilelist(h);
-
+
rpmfiBuildFNames(h, RPMTAG_BASENAMES, &fileNames, &count);
if (fileNames == NULL || count <= 0)
fileNames = _free(fileNames);
}
-/**
+/**
*/
static PyObject * rhnUnload(hdrObject * s, PyObject * args)
/*@*/
return rc;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * hdrFullFilelist(hdrObject * s, PyObject * args)
/*@*/
return Py_None;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * hdrSprintf(hdrObject * s, PyObject * args)
/*@*/
return (long) h;
}
-/** \ingroup python
+/** \ingroup py_c
*/
/*@unchecked@*/ /*@observer@*/
static struct PyMethodDef hdr_methods[] = {
{NULL, NULL} /* sentinel */
};
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * hdr_getattr(hdrObject * s, char * name)
/*@*/
return Py_FindMethod(hdr_methods, (PyObject * ) s, name);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static void hdr_dealloc(hdrObject * s)
/*@*/
PyObject_Del(s);
}
-/** \ingroup python
+/** \ingroup py_c
*/
long tagNumFromPyObject (PyObject *item)
{
return -1;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * hdr_subscript(hdrObject * s, PyObject * item)
/*@*/
PyErr_SetString(PyExc_KeyError, "unknown header tag");
return NULL;
}
-
+
if (!rpmHeaderGetEntry(s->h, tag, &type, &data, &count)) {
Py_INCREF(Py_None);
return Py_None;
return o;
}
-/** \ingroup python
+/** \ingroup py_c
*/
/*@unchecked@*/ /*@observer@*/
static PyMappingMethods hdr_as_mapping = {
static char hdr_doc[] =
"";
-/** \ingroup python
+/** \ingroup py_c
*/
/*@unchecked@*/ /*@observer@*/
PyTypeObject hdr_Type = {
int len;
if (!PyArg_ParseTuple(args, "s#", &obj, &len)) return NULL;
-
+
/* malloc is needed to avoid surprises from data swab in headerLoad(). */
copy = malloc(len);
if (copy == NULL) {
int len;
if (!PyArg_ParseTuple(args, "s#", &obj, &len)) return NULL;
-
+
/* malloc is needed to avoid surprises from data swab in headerLoad(). */
copy = malloc(len);
if (copy == NULL) {
#ifndef RPMPYTHON_HEADER
#define RPMPYTHON_HEADER
-/** \ingroup python
+/** \ingroup py_c
* \file python/header-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
*/
typedef struct hdrObject_s hdrObject;
/*@unchecked@*/
extern PyTypeObject hdr_Type;
-/** \ingroup python
+/** \ingroup py_c
*/
PyObject * pyrpmError;
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmal-py.c
*/
#include "rpmal.h"
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmal-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmbc-py.c
*/
return so;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static int rpmbc_init(rpmbcObject * z, PyObject *args, PyObject *kwds)
/*@modifies z @*/
return 0;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static void rpmbc_free(/*@only@*/ rpmbcObject * s)
/*@modifies s @*/
PyObject_Del(s);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmbc_alloc(PyTypeObject * subtype, int nitems)
/*@*/
/* ---------- */
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmbc_Debug(/*@unused@*/ rpmbcObject * s, PyObject * args)
return Py_None;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmbc_Gcd(/*@unused@*/ rpmbcObject * s, PyObject * args)
return (PyObject *)z;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmbc_Sqrt(/*@unused@*/ rpmbcObject * s, PyObject * args)
#include "rpmio_internal.h"
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmbc-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmdb-py.c
*/
#include "rpmdb.h"
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmdb-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
*/
typedef struct rpmdbObject_s rpmdbObject;
-/** \ingroup python
+/** \ingroup py_c
*/
struct rpmdbObject_s {
PyObject_HEAD
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmds-py.c
*/
#include "rpmds.h"
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmds-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmfd-py.c
*/
return PyFile_FromFile (node->f, path, mode, closeCallback);
}
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
/*@unchecked@*/ /*@observer@*/
/* ---------- */
-/** \ingroup python
+/** \ingroup py_c
*/
static void
rpmfd_dealloc(/*@only@*/ /*@null@*/ rpmfdObject * s)
}
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmfd_getattr(rpmfdObject * o, char * name)
/*@*/
return Py_FindMethod(rpmfd_methods, (PyObject *) o, name);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static int rpmfd_init(rpmfdObject * s, PyObject *args, PyObject *kwds)
/*@modifies s @*/
return 0;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static void rpmfd_free(/*@only@*/ rpmfdObject * s)
/*@modifies s @*/
PyObject_Del((PyObject *)s);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmfd_alloc(PyTypeObject * subtype, int nitems)
/*@*/
return s;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static rpmfdObject * rpmfd_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
/*@*/
static char rpmfd_doc[] =
"";
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
PyTypeObject rpmfd_Type = {
#ifndef H_RPMFD_PY
#define H_RPMFD_PY
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmfd-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmfi-py.c
*/
#include "rpmfi.h"
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmfi-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmfts-py.c
*/
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
/*@unchecked@*/ /*@observer@*/
static char rpmfts_doc[] =
"";
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
PyTypeObject rpmfts_Type = {
#ifndef H_RPMFTS_PY
#define H_RPMFTS_PY
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmfts-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmmi-py.c
*/
}
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
/*@unchecked@*/ /*@observer@*/
};
/*@=fullinitblock@*/
-/** \ingroup python
+/** \ingroup py_c
*/
static void rpmmi_dealloc(/*@only@*/ /*@null@*/ rpmmiObject * s)
/*@globals rpmGlobalMacroContext @*/
}
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmmi_getattr (rpmmiObject *s, char *name)
/*@*/
static char rpmmi_doc[] =
"";
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
PyTypeObject rpmmi_Type = {
#ifndef H_RPMMI_PY
#define H_RPMMI_PY
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmmi-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
*/
typedef struct rpmmiObject_s rpmmiObject;
-/** \ingroup python
+/** \ingroup py_c
*/
struct rpmmiObject_s {
PyObject_HEAD
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmmodule.c
*/
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmrc-py.c
*/
return NULL;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static int rpmrc_init(PyObject * s, PyObject *args, PyObject *kwds)
/*@*/
return 0;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static void rpmrc_free(PyObject * s)
/*@*/
_PyObject_GC_Del(s);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmrc_alloc(PyTypeObject * subtype, int nitems)
/*@*/
return (PyObject *) ns;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmrc_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
/*@*/
};
/*@=fullinitblock@*/
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
#if Py_TPFLAGS_HAVE_ITER
#ifndef H_RPMRC_PY
#define H_RPMRC_PY
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmrc-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
*/
typedef struct rpmrcObject_s rpmrcObject;
-/** \ingroup python
+/** \ingroup py_c
*/
struct rpmrcObject_s {
#if Py_TPFLAGS_HAVE_ITER /* XXX backport to python-1.5.2 */
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmte-py.c
*/
return (PyObject *) rpmfi_Wrap(rpmfiLink(fi, "rpmte_FI"));
}
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
/*@unchecked@*/ /*@observer@*/
return 0;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmte_getattr(rpmteObject * o, char * name)
/*@*/
static char rpmte_doc[] =
"";
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
PyTypeObject rpmte_Type = {
#include "rpmte.h"
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmte-py.h
*/
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmts-py.c
*/
* the ts.run() method.
*/
-/** \ingroup python
+/** \ingroup py_c
*/
struct rpmtsCallbackType_s {
PyObject * cb;
PyThreadState *_save;
};
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_Debug(/*@unused@*/ rpmtsObject * s, PyObject * args)
return Py_None;
}
-/** \ingroup python
+/** \ingroup py_c
* Add package to universe of possible packages to install in transaction set.
* @param ts transaction set
* @param h header
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_AddInstall(rpmtsObject * s, PyObject * args)
return Py_None;
}
-/** \ingroup python
+/** \ingroup py_c
* @todo Permit finer control (i.e. not just --allmatches) of deleted elments.
*/
static PyObject *
return Py_None;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static int
rpmts_SolveCallback(rpmts ts, rpmds ds, const void * data)
return res;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_Check(rpmtsObject * s, PyObject * args)
return Py_None;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_Order(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_Clean(rpmtsObject * s, PyObject * args)
return Py_None;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_IDTXload(rpmtsObject * s, PyObject * args)
return result;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_IDTXglob(rpmtsObject * s, PyObject * args)
return result;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_Rollback(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_OpenDB(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rpmtsOpenDB(s->ts, s->ts->dbmode));
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_CloseDB(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_InitDB(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_RebuildDB(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_VerifyDB(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_HdrFromFdno(rpmtsObject * s, PyObject * args)
return result;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_HdrCheck(rpmtsObject * s, PyObject * args)
return result;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_SetVSFlags(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rpmtsSetVSFlags(s->ts, vsflags));
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_SetColor(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rpmtsSetColor(s->ts, tscolor));
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_PgpPrtPkts(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_PgpImportPubkey(rpmtsObject * s, PyObject * args)
return Py_BuildValue("i", rc);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject *
rpmts_GetKeys(rpmtsObject * s, PyObject * args)
return tuple;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static void *
rpmtsCallback(/*@unused@*/ const void * hd, const rpmCallbackType what,
return NULL;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmts_SetFlags(rpmtsObject * s, PyObject * args)
/*@modifies s @*/
return Py_BuildValue("i", rpmtsSetFlags(s->ts, transFlags));
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmts_SetProbFilter(rpmtsObject * s, PyObject * args)
/*@modifies s @*/
return Py_BuildValue("i", oignoreSet);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmts_Run(rpmtsObject * s, PyObject * args)
/*@globals rpmGlobalMacroContext, _Py_NoneStruct @*/
return rpmmi_Wrap( rpmtsInitIterator(s->ts, tag, key, len) );
}
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
/*@unchecked@*/ /*@observer@*/
};
/*@=fullinitblock@*/
-/** \ingroup python
+/** \ingroup py_c
*/
static void rpmts_dealloc(/*@only@*/ rpmtsObject * s)
/*@modifies *s @*/
PyObject_Del((PyObject *)s);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmts_getattr(rpmtsObject * o, char * name)
/*@*/
return Py_FindMethod(rpmts_methods, (PyObject *) o, name);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static int rpmts_setattr(rpmtsObject * o, char * name, PyObject * val)
/*@modifies o @*/
return 0;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static int rpmts_init(rpmtsObject * s, PyObject *args, PyObject *kwds)
/*@globals rpmGlobalMacroContext @*/
return 0;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static void rpmts_free(/*@only@*/ rpmtsObject * s)
/*@modifies s @*/
PyObject_Del((PyObject *)s);
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmts_alloc(PyTypeObject * subtype, int nitems)
/*@*/
return s;
}
-/** \ingroup python
+/** \ingroup py_c
*/
static PyObject * rpmts_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
/*@globals rpmGlobalMacroContext @*/
static char rpmts_doc[] =
"";
-/** \ingroup python
+/** \ingroup py_c
*/
/*@-fullinitblock@*/
PyTypeObject rpmts_Type = {
#include "rpmts.h"
-/** \ingroup python
+/** \ingroup py_c
* \file python/rpmts-py.h
*/