Realize the remaining bits of direct rpmdb interface are dead too
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 22 Sep 2009 15:17:49 +0000 (18:17 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 22 Sep 2009 15:17:49 +0000 (18:17 +0300)
- the code hasn't been enabled in a long long time despite being built...

python/Makefile.am
python/rpmdb-py.c [deleted file]
python/rpmdb-py.h [deleted file]

index 2d09af0..fa3af26 100644 (file)
@@ -21,7 +21,6 @@ _rpmmodule_la_LIBADD = \
 _rpmmodule_la_SOURCES = rpmmodule.c system.h \
        header-py.c header-py.h \
        rpmds-py.c rpmds-py.h \
-       rpmdb-py.c rpmdb-py.h \
        rpmfi-py.c rpmfi-py.h \
        rpmmi-py.c rpmmi-py.h \
        rpmps-py.c rpmps-py.h \
diff --git a/python/rpmdb-py.c b/python/rpmdb-py.c
deleted file mode 100644 (file)
index be7aca0..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/** \ingroup py_c
- * \file python/rpmdb-py.c
- */
-
-#include "system.h"
-
-#include <rpm/header.h>
-
-#include "rpmdb-py.h"
-#include "rpmmi-py.h"
-#include "header-py.h"
-
-#include "debug.h"
-
-
-/** \ingroup python
- * \class Rpmdb
- * \brief A python rpmdb object represents an RPM database.
- *
- * Instances of the rpmdb object provide access to the records of a
- * RPM database.  The records are accessed by index number.  To
- * retrieve the header data in the RPM database, the rpmdb object is
- * subscripted as you would access members of a list.
- *
- * The rpmdb class contains the following methods:
- *
- * - firstkey()        Returns the index of the first record in the database.
- * @deprecated Use mi = ts.dbMatch() (or db.match()) instead.
- *
- * - nextkey(index) Returns the index of the next record after "index" in the
- *             database.
- * @param index        current rpmdb location
- * @deprecated Use hdr = mi.next() instead.
- *
- * - findbyfile(file) Returns a list of the indexes to records that own file
- *             "file".
- * @param file absolute path to file
- * @deprecated Use mi = ts.dbMatch('basename') instead.
- *
- * - findbyname(name) Returns a list of the indexes to records for packages
- *             named "name".
- * @param name package name
- * @deprecated Use mi = ts.dbMatch('name') instead.
- *
- * - findbyprovides(dep) Returns a list of the indexes to records for packages
- *             that provide "dep".
- * @param dep  provided dependency string
- * @deprecated Use mi = ts.dbMmatch('providename') instead.
- *
- * To obtain a db object explicitly, the opendb function in the rpm module
- * can be called. The opendb function takes two optional arguments.
- * The first optional argument is a boolean flag that specifies if the
- * database is to be opened for read/write access or read-only access.
- * The second argument specifies an alternate root directory for RPM
- * to use.
- *
- * Note that in most cases, one is interested in querying the default
- * database in /var/lib/rpm and an rpm.mi match iterator derived from
- * an implicit open of the database from an rpm.ts transaction set object:
- * \code
- *     import rpm
- *     ts = rpm.TransactionSet()
- *     mi = ts.dbMatch()
- *     ...
- * \endcode
- * is simpler than explicitly opening a database object:
- * \code
- *     import rpm
- *     db = rpm.opendb()
- *     mi = db.match()
- * \endcode
- *
- * An example of opening a database and retrieving the first header in
- * the database, then printing the name of the package that the header
- * represents:
- * \code
- *     import rpm
- *     db = rpm.opendb()
- *     mi = db.match()
- *     if mi:
- *         h = mi.next()
- *         if h:
- *             print h['name']
- * \endcode
- *
- * To print all of the packages in the database that match a package
- * name, the code will look like this:
- * \code
- *     import rpm
- *     db = rpm.opendb()
- *     mi = db.match('name', "foo")
- *     while mi:
- *         h = mi.next()
- *         if not h:
- *             break
- *         print "%s-%s-%s" % (h['name'], h['version'], h['release'])
- * \endcode
- */
-
-/** \ingroup python
- * \name Class: rpm.db
- */
-
-/** \ingroup py_c
- */
-struct rpmdbObject_s {
-    PyObject_HEAD
-    PyObject *md_dict;         /*!< to look like PyModuleObject */
-    rpmdb db;
-    int offx;
-    int noffs;
-    int *offsets;
-} ;
-
-/**
- */
-static rpmmiObject *
-rpmdb_Match (rpmdbObject * s, PyObject * args, PyObject * kwds)
-{
-    PyObject *TagN = NULL;
-    char *key = NULL;
-    int len = 0;
-    rpmTag tag = RPMDBI_PACKAGES;
-    char * kwlist[] = {"tagNumber", "key", "len", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Ozi", kwlist,
-           &TagN, &key, &len))
-       return NULL;
-
-    if (TagN && (tag = tagNumFromPyObject (TagN)) == -1) {
-       PyErr_SetString(PyExc_TypeError, "unknown tag type");
-       return NULL;
-    }
-
-    return rpmmi_Wrap( rpmdbInitIterator(s->db, tag, key, len), (PyObject *)s);
-}
-
-/**
- */
-static struct PyMethodDef rpmdb_methods[] = {
-    {"match",      (PyCFunction) rpmdb_Match,  METH_VARARGS|METH_KEYWORDS,
-"db.match([TagN, [key, [len]]]) -> mi\n\
-- Create an rpm db match iterator.\n" },
-    {NULL,             NULL}           /* sentinel */
-};
-
-/**
- */
-static int
-rpmdb_length(rpmdbObject * s)
-{
-    rpmdbMatchIterator mi;
-    int count = 0;
-
-    mi = rpmdbInitIterator(s->db, RPMDBI_PACKAGES, NULL, 0);
-    while (rpmdbNextIterator(mi) != NULL)
-       count++;
-    mi = rpmdbFreeIterator(mi);
-
-    return count;
-}
-
-/**
- */
-static hdrObject *
-rpmdb_subscript(rpmdbObject * s, PyObject * key)
-{
-    int offset;
-    hdrObject * ho;
-    Header h;
-    rpmdbMatchIterator mi;
-
-    if (!PyInt_Check(key)) {
-       PyErr_SetString(PyExc_TypeError, "integer expected");
-       return NULL;
-    }
-
-    offset = (int) PyInt_AsLong(key);
-
-    mi = rpmdbInitIterator(s->db, RPMDBI_PACKAGES, &offset, sizeof(offset));
-    if (!(h = rpmdbNextIterator(mi))) {
-       mi = rpmdbFreeIterator(mi);
-       PyErr_SetString(pyrpmError, "cannot read rpmdb entry");
-       return NULL;
-    }
-
-    ho = hdr_Wrap(h);
-    h = headerFree(h);
-
-    return ho;
-}
-
-/**
- */
-static PyMappingMethods rpmdb_as_mapping = {
-       (lenfunc) rpmdb_length,         /* mp_length */
-       (binaryfunc) rpmdb_subscript,   /* mp_subscript */
-       (objobjargproc)0,               /* mp_ass_subscript */
-};
-
-/**
- */
-static void rpmdb_dealloc(rpmdbObject * s)
-{
-    if (s->db != NULL)
-       rpmdbClose(s->db);
-    PyObject_Del(s);
-}
-
-/**
- */
-static char rpmdb_doc[] =
-"";
-
-/**
- */
-PyTypeObject rpmdb_Type = {
-       PyObject_HEAD_INIT(&PyType_Type)
-       0,                              /* ob_size */
-       "rpm.db",                       /* tp_name */
-       sizeof(rpmdbObject),            /* tp_size */
-       0,                              /* tp_itemsize */
-       (destructor) rpmdb_dealloc,     /* tp_dealloc */
-       0,                              /* tp_print */
-       (getattrfunc)0,                 /* tp_getattr */
-       0,                              /* tp_setattr */
-       0,                              /* tp_compare */
-       0,                              /* tp_repr */
-       0,                              /* tp_as_number */
-       0,                              /* tp_as_sequence */
-       &rpmdb_as_mapping,              /* tp_as_mapping */
-       0,                              /* tp_hash */
-       0,                              /* tp_call */
-       0,                              /* tp_str */
-       PyObject_GenericGetAttr,        /* tp_getattro */
-       PyObject_GenericSetAttr,        /* tp_setattro */
-       0,                              /* tp_as_buffer */
-       Py_TPFLAGS_DEFAULT,             /* tp_flags */
-       rpmdb_doc,                      /* tp_doc */
-       0,                              /* tp_traverse */
-       0,                              /* tp_clear */
-       0,                              /* tp_richcompare */
-       0,                              /* tp_weaklistoffset */
-       0,                              /* tp_iter */
-       0,                              /* tp_iternext */
-       rpmdb_methods,                  /* tp_methods */
-       0,                              /* tp_members */
-       0,                              /* tp_getset */
-       0,                              /* tp_base */
-       0,                              /* tp_dict */
-       0,                              /* tp_descr_get */
-       0,                              /* tp_descr_set */
-       0,                              /* tp_dictoffset */
-       0,                              /* tp_init */
-       0,                              /* tp_alloc */
-       0,                              /* tp_new */
-       0,                              /* tp_free */
-       0,                              /* tp_is_gc */
-};
-
diff --git a/python/rpmdb-py.h b/python/rpmdb-py.h
deleted file mode 100644 (file)
index c92d74a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef H_RPMDB_PY
-#define H_RPMDB_PY
-
-#include <rpm/rpmdb.h>
-
-/** \ingroup py_c
- * \file python/rpmdb-py.h
- */
-
-/** \ingroup py_c
- */
-typedef struct rpmdbObject_s rpmdbObject;
-
-extern PyTypeObject rpmdb_Type;
-
-#endif