summaryrefslogtreecommitdiffstats
path: root/rpmmodule/rpmmodule.c
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>1999-08-26 00:21:30 +0000
committerMatt Wilson <msw@redhat.com>1999-08-26 00:21:30 +0000
commit9f7d47ce097271ebc86a06e6dd2da888fb0e163d (patch)
tree02cf1fdbf108e691c645048500eecde35a95a073 /rpmmodule/rpmmodule.c
parentec5eda29cc3fd6899c9e60006e9cb83de5102675 (diff)
downloadanaconda-9f7d47ce097271ebc86a06e6dd2da888fb0e163d.tar.gz
anaconda-9f7d47ce097271ebc86a06e6dd2da888fb0e163d.tar.xz
anaconda-9f7d47ce097271ebc86a06e6dd2da888fb0e163d.zip
FindPackage
Diffstat (limited to 'rpmmodule/rpmmodule.c')
-rw-r--r--rpmmodule/rpmmodule.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/rpmmodule/rpmmodule.c b/rpmmodule/rpmmodule.c
index 10dc7b5f6..2d912857f 100644
--- a/rpmmodule/rpmmodule.c
+++ b/rpmmodule/rpmmodule.c
@@ -9,6 +9,9 @@
#include "rpmlib.h"
#include "upgrade.h"
+/* from lib/misc.c */
+int rpmvercmp(const char * one, const char * two);
+
/* Forward types */
typedef struct rpmdbObject_s rpmdbObject;
@@ -24,6 +27,7 @@ static PyObject * rpmdbNext(rpmdbObject * s, PyObject * args);
static PyObject * rpmdbByName(rpmdbObject * s, PyObject * args);
static PyObject * rpmdbByProvides(rpmdbObject * s, PyObject * args);
static PyObject * rpmdbByFile(rpmdbObject * s, PyObject * args);
+static PyObject * dbFindPackage(rpmdbObject * s, PyObject * args);
static int rpmdbLength(rpmdbObject * s);
static hdrObject * rpmdbSubscript(rpmdbObject * s, PyObject * key);
@@ -176,6 +180,7 @@ static struct PyMethodDef rpmdbMethods[] = {
{"findbyfile", (PyCFunction) rpmdbByFile, 1 },
{"findbyname", (PyCFunction) rpmdbByName, 1 },
{"findbyprovides", (PyCFunction) rpmdbByProvides, 1 },
+ {"findpackage", (PyCFunction) dbFindPackage, 1 },
{NULL, NULL} /* sentinel */
};
@@ -750,6 +755,17 @@ static PyObject * rpmdbByProvides(rpmdbObject * s, PyObject * args) {
return handleDbResult(rc, matches);
}
+static PyObject * dbFindPackage(rpmdbObject * s, PyObject * args) {
+ char * str;
+ dbiIndexSet matches;
+ int rc;
+
+ if (!PyArg_ParseTuple(args, "s", &str)) return NULL;
+
+ rc = rpmdbFindPackage(s->db, str, &matches);
+ return handleDbResult(rc, matches);
+}
+
static int rpmdbLength(rpmdbObject * s) {
int first;
int count = 0;