diff options
Diffstat (limited to 'rpmmodule/rpmmodule.c')
-rw-r--r-- | rpmmodule/rpmmodule.c | 16 |
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; |