diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-02-05 11:43:38 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-02-05 11:43:38 +0200 |
commit | b12cb085232a586ebca8673ee766d9d6e826c8dd (patch) | |
tree | 36bf8950bc252e455738bf2b5b68cde4ea7dc503 /python | |
parent | e1ca3be052b4f0bbc417489c3f97a00323630469 (diff) | |
download | librpm-tizen-b12cb085232a586ebca8673ee766d9d6e826c8dd.tar.gz librpm-tizen-b12cb085232a586ebca8673ee766d9d6e826c8dd.tar.bz2 librpm-tizen-b12cb085232a586ebca8673ee766d9d6e826c8dd.zip |
Port some rpmds improvements from rpm5.org
- rpmlib provides as rpmds, lose the special case hackery
- new functions rpmdsRpmlib() and rpmdsSearch() + python bindings for them
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmds-py.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/python/rpmds-py.c b/python/rpmds-py.c index fabd99eab..87b12dc4f 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -312,6 +312,33 @@ rpmds_Merge(rpmdsObject * s, PyObject * args, PyObject * kwds) o = (rpmdsObject *)to; return Py_BuildValue("i", rpmdsMerge(&s->ds, o->ds)); } +static PyObject * +rpmds_Search(rpmdsObject * s, PyObject * args, PyObject * kwds) +{ + PyObject * to = NULL; + rpmdsObject * o; + char * kwlist[] = {"element", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:Merge", kwlist, &to)) + return NULL; + + /* XXX ds type check needed. */ + o = (rpmdsObject *)to; + return Py_BuildValue("i", rpmdsSearch(s->ds, o->ds)); +} + +static PyObject * +rpmds_Rpmlib(rpmdsObject * s) +{ + rpmds ds = NULL; + int xx; + + /* XXX check return code, permit arg (NULL uses system default). */ + xx = rpmdsRpmlib(&ds, NULL); + + return (PyObject *) rpmds_Wrap( ds ); +} + #ifdef NOTYET static PyObject * @@ -375,6 +402,12 @@ static struct PyMethodDef rpmds_methods[] = { NULL}, {"Merge", (PyCFunction)rpmds_Merge, METH_VARARGS|METH_KEYWORDS, NULL}, + {"Search", (PyCFunction)rpmds_Search, METH_VARARGS|METH_KEYWORDS, +"ds.Search(element) -> matching ds index (-1 on failure)\n\ +- Check that element dependency range overlaps some member of ds.\n\ +The current index in ds is positioned at overlapping member upon success.\n" }, + {"Rpmlib", (PyCFunction)rpmds_Rpmlib, METH_NOARGS|METH_STATIC, + "ds.Rpmlib -> nds - Return internal rpmlib dependency set.\n"}, #ifdef NOTYET {"Compare", (PyCFunction)rpmds_Compare, METH_VARARGS|METH_KEYWORDS, NULL}, |