summaryrefslogtreecommitdiff
path: root/python/rpmds-py.c
diff options
context:
space:
mode:
authorwangbiao <biao716.wang@samsung.com>2023-11-16 18:17:42 +0900
committerwangbiao <biao716.wang@samsung.com>2023-11-16 18:17:42 +0900
commitc30d127e8780dc678168ee121b9f2eeb1a8aaafa (patch)
treecdc9ddc3123edd5741e5151f3076c9bfc9535916 /python/rpmds-py.c
parent258ff2bdb80c458b743417c427f66fa5f27bf7c5 (diff)
downloadlibrpm-tizen-c30d127e8780dc678168ee121b9f2eeb1a8aaafa.tar.gz
librpm-tizen-c30d127e8780dc678168ee121b9f2eeb1a8aaafa.tar.bz2
librpm-tizen-c30d127e8780dc678168ee121b9f2eeb1a8aaafa.zip
Upgrade version to 4.14tizen/4.14.1.1.tizen20230628
Change-Id: I21bf1a3a7c25cbec43022202cf2e5865b603a309 Signed-off-by: wangbiao <biao716.wang@samsung.com>
Diffstat (limited to 'python/rpmds-py.c')
-rw-r--r--python/rpmds-py.c82
1 files changed, 40 insertions, 42 deletions
diff --git a/python/rpmds-py.c b/python/rpmds-py.c
index 4b44220dc..9eae9a228 100644
--- a/python/rpmds-py.c
+++ b/python/rpmds-py.c
@@ -6,6 +6,7 @@
#include "header-py.h"
#include "rpmds-py.h"
+#include "rpmstrpool-py.h"
struct rpmdsObject_s {
PyObject_HEAD
@@ -96,21 +97,6 @@ rpmds_SetNoPromote(rpmdsObject * s, PyObject * args, PyObject * kwds)
return Py_BuildValue("i", rpmdsSetNoPromote(s->ds, nopromote));
}
-static PyObject *
-rpmds_Notify(rpmdsObject * s, PyObject * args, PyObject * kwds)
-{
- const char * where;
- int rc;
- char * kwlist[] = {"location", "returnCode", NULL};
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "si:Notify", kwlist,
- &where, &rc))
- return NULL;
-
- rpmdsNotify(s->ds, where, rc);
- Py_RETURN_NONE;
-}
-
/* XXX rpmdsFind uses bsearch on s->ds, so a sort is needed. */
static PyObject *
rpmds_Sort(rpmdsObject * s)
@@ -169,12 +155,18 @@ static PyObject *rpmds_Instance(rpmdsObject * s)
return Py_BuildValue("i", rpmdsInstance(s->ds));
}
-static PyObject * rpmds_Rpmlib(rpmdsObject * s)
+static PyObject * rpmds_Rpmlib(rpmdsObject * s, PyObject *args, PyObject *kwds)
{
+ rpmstrPool pool = NULL;
rpmds ds = NULL;
+ char * kwlist[] = {"pool", NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O&:rpmds_Rpmlib", kwlist,
+ &poolFromPyObject, &pool))
+ return NULL;
/* XXX check return code, permit arg (NULL uses system default). */
- rpmdsRpmlib(&ds, NULL);
+ rpmdsRpmlibPool(pool, &ds, NULL);
return rpmds_Wrap(&rpmds_Type, ds);
}
@@ -183,39 +175,39 @@ static struct PyMethodDef rpmds_methods[] = {
{"Count", (PyCFunction)rpmds_Count, METH_NOARGS,
"Deprecated, use len(ds) instead.\n" },
{"Ix", (PyCFunction)rpmds_Ix, METH_NOARGS,
- "ds.Ix -> Ix - Return current element index.\n" },
+ "ds.Ix -> Ix -- Return current element index.\n" },
{"DNEVR", (PyCFunction)rpmds_DNEVR, METH_NOARGS,
- "ds.DNEVR -> DNEVR - Return current DNEVR.\n" },
+ "ds.DNEVR -> DNEVR -- Return current DNEVR.\n" },
{"N", (PyCFunction)rpmds_N, METH_NOARGS,
- "ds.N -> N - Return current N.\n" },
+ "ds.N -> N -- Return current N.\n" },
{"EVR", (PyCFunction)rpmds_EVR, METH_NOARGS,
- "ds.EVR -> EVR - Return current EVR.\n" },
+ "ds.EVR -> EVR -- Return current EVR.\n" },
{"Flags", (PyCFunction)rpmds_Flags, METH_NOARGS,
- "ds.Flags -> Flags - Return current Flags.\n" },
+ "ds.Flags -> Flags -- Return current Flags.\n" },
{"TagN", (PyCFunction)rpmds_TagN, METH_NOARGS,
- "ds.TagN -> TagN - Return current TagN.\n" },
+ "ds.TagN -> TagN -- Return TagN (RPMTAG_*NAME)\n\n"
+ "the type of all dependencies in this set.\n" },
{"Color", (PyCFunction)rpmds_Color, METH_NOARGS,
- "ds.Color -> Color - Return current Color.\n" },
+ "ds.Color -> Color -- Return current Color.\n" },
{"SetNoPromote",(PyCFunction)rpmds_SetNoPromote, METH_VARARGS|METH_KEYWORDS,
- NULL},
- {"Notify", (PyCFunction)rpmds_Notify, METH_VARARGS|METH_KEYWORDS,
- NULL},
+ "ds.SetNoPromote(noPromote) -- Set noPromote for this instance.\n\n"
+ "If True non existing epochs are no longer equal to an epoch of 0."},
{"Sort", (PyCFunction)rpmds_Sort, METH_NOARGS,
NULL},
{"Find", (PyCFunction)rpmds_Find, METH_O,
- NULL},
+ "ds.find(other_ds) -- Return index of other_ds in ds"},
{"Merge", (PyCFunction)rpmds_Merge, METH_O,
NULL},
{"Search", (PyCFunction)rpmds_Search, METH_O,
"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"},
+Check that element dependency range overlaps some member of ds.\n\
+The current index in ds is positioned at overlapping member." },
+ {"Rpmlib", (PyCFunction)rpmds_Rpmlib, METH_VARARGS|METH_KEYWORDS|METH_STATIC,
+ "ds.Rpmlib -> nds -- Return internal rpmlib dependency set.\n"},
{"Compare", (PyCFunction)rpmds_Compare, METH_O,
- NULL},
+ "ds.compare(other) -- Compare current entries of self and other.\n\nReturns True if the entries match each other, False otherwise"},
{"Instance", (PyCFunction)rpmds_Instance, METH_NOARGS,
- NULL},
+ "ds.Instance() -- Return rpmdb key of corresponding package or 0."},
{NULL, NULL} /* sentinel */
};
@@ -305,10 +297,12 @@ static PyObject * rpmds_new(PyTypeObject * subtype, PyObject *args, PyObject *kw
rpmTagVal tagN = RPMTAG_REQUIRENAME;
rpmds ds = NULL;
Header h = NULL;
- char * kwlist[] = {"obj", "tag", NULL};
+ rpmstrPool pool = NULL;
+ char * kwlist[] = {"obj", "tag", "pool", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:rpmds_new", kwlist,
- &obj, tagNumFromPyObject, &tagN))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&|O&:rpmds_new", kwlist,
+ &obj, tagNumFromPyObject, &tagN,
+ &poolFromPyObject, &pool))
return NULL;
if (PyTuple_Check(obj)) {
@@ -317,16 +311,16 @@ static PyObject * rpmds_new(PyTypeObject * subtype, PyObject *args, PyObject *kw
rpmsenseFlags flags = RPMSENSE_ANY;
/* TODO: if flags are specified, evr should be required too */
if (PyArg_ParseTuple(obj, "s|O&s", &name, depflags, &flags, &evr)) {
- ds = rpmdsSingle(tagN, name, evr, flags);
+ ds = rpmdsSinglePool(pool, tagN, name, evr, flags);
} else {
PyErr_SetString(PyExc_ValueError, "invalid dependency tuple");
return NULL;
}
} else if (hdrFromPyObject(obj, &h)) {
if (tagN == RPMTAG_NEVR) {
- ds = rpmdsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
+ ds = rpmdsThisPool(pool, h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
} else {
- ds = rpmdsNew(h, tagN, 0);
+ ds = rpmdsNewPool(pool, h, tagN, 0);
}
} else {
PyErr_SetString(PyExc_TypeError, "header or tuple expected");
@@ -337,11 +331,15 @@ static PyObject * rpmds_new(PyTypeObject * subtype, PyObject *args, PyObject *kw
}
static char rpmds_doc[] =
-"";
+ "rpm.ds (dependendcy set) gives a more convenient access to dependencies\n\n"
+ "It can hold multiple entries of Name Flags and EVR.\n"
+ "It typically represents all dependencies of one kind of a package\n"
+ "e.g. all Requires or all Conflicts.\n"
+ ;
PyTypeObject rpmds_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
- PYTHON_MODULENAME".ds", /* tp_name */
+ "rpm.ds", /* tp_name */
sizeof(rpmdsObject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */