diff options
author | jbj <devnull@localhost> | 2004-10-11 23:31:18 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-10-11 23:31:18 +0000 |
commit | 12ccd4fb2feb43f81ec6db27e38e8a04778f4c3f (patch) | |
tree | 64359f22464dfcac01f0a994cf1052e0f95a0884 | |
parent | 771d9e1222a2d2fc0790c5b9ae769f494ac61725 (diff) | |
download | librpm-tizen-12ccd4fb2feb43f81ec6db27e38e8a04778f4c3f.tar.gz librpm-tizen-12ccd4fb2feb43f81ec6db27e38e8a04778f4c3f.tar.bz2 librpm-tizen-12ccd4fb2feb43f81ec6db27e38e8a04778f4c3f.zip |
Add Find and Merge methods, Sort stub.
CVS patchset: 7449
CVS date: 2004/10/11 23:31:18
-rw-r--r-- | python/rpmds-py.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/python/rpmds-py.c b/python/rpmds-py.c index 4d9366817..f033cc6dd 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -314,7 +314,67 @@ rpmds_Notify(rpmdsObject * s, PyObject * args) return Py_None; } +/* XXX rpmdsFind uses bsearch on s->ds, so a sort is needed. */ +static PyObject * +rpmds_Sort(rpmdsObject * s, PyObject * args) + /*@modifies s @*/ +{ + if (!PyArg_ParseTuple(args, ":Sort")) + return NULL; + /* XXX sort on (N,EVR,F) here. */ + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * +rpmds_Find(rpmdsObject * s, PyObject * args) + /*@modifies s @*/ +{ + PyObject * to = NULL; + rpmdsObject * o; + int rc; + + if (!PyArg_ParseTuple(args, "O:Find", &to)) + return NULL; + /* XXX ds type check needed. */ + o = (rpmdsObject *)to; + + /* XXX make sure ods index is valid, real fix in lib/rpmds.c. */ + if (rpmdsIx(o->ds) == -1) rpmdsSetIx(o->ds, 0); + + rc = rpmdsFind(s->ds, o->ds); + return Py_BuildValue("i", rc); +} + +static PyObject * +rpmds_Merge(rpmdsObject * s, PyObject * args) + /*@modifies s @*/ +{ + PyObject * to = NULL; + rpmdsObject * o; + + if (!PyArg_ParseTuple(args, "O:Find", &to)) + return NULL; + /* XXX ds type check needed. */ + o = (rpmdsObject *)to; + return Py_BuildValue("i", rpmdsMerge(&s->ds, o->ds)); +} + #ifdef NOTYET +static PyObject * +rpmds_Compare(rpmdsObject * s, PyObject * args) + /*@modifies s @*/ +{ + PyObject * to = NULL; + rpmdsObject * o; + + if (!PyArg_ParseTuple(args, "O:Compare", &to)) + return NULL; + /* XXX ds type check needed. */ + o = (rpmdsObject *)to; + return Py_BuildValue("i", rpmdsCompare(s->ds, o->ds)); +} + /*@null@*/ static PyObject * rpmds_Problem(rpmdsObject * s, PyObject * args) @@ -359,7 +419,15 @@ static struct PyMethodDef rpmds_methods[] = { NULL}, {"Notify", (PyCFunction)rpmds_Notify, METH_VARARGS, NULL}, + {"Sort", (PyCFunction)rpmds_Sort, METH_VARARGS, + NULL}, + {"Find", (PyCFunction)rpmds_Find, METH_VARARGS, + NULL}, + {"Merge", (PyCFunction)rpmds_Merge, METH_VARARGS, + NULL}, #ifdef NOTYET + {"Compare", (PyCFunction)rpmds_Compare, METH_VARARGS, + NULL}, {"Problem", (PyCFunction)rpmds_Problem, METH_VARARGS, NULL}, #endif |