Push transaction problem filter to python side

- make C-level ts.run() require ignoreSet just like the real one does
  and keep the value on python side of things
This commit is contained in:
Panu Matilainen 2009-10-05 12:16:26 +03:00
parent 44ee4e164e
commit 66589df18f
2 changed files with 8 additions and 12 deletions

View File

@ -4,6 +4,7 @@ import _rpm
# TODO: migrate relevant documentation from C-side
class TransactionSet(_rpm.ts):
_probFilter = 0
# FIXME: kludge for keeping refcounts on transaction element keys
_keyList = []
@ -84,7 +85,7 @@ class TransactionSet(_rpm.ts):
del hdrs
def run(self, callback, data):
rc = _rpm.ts.run(self, callback, data)
rc = _rpm.ts.run(self, callback, data, self._probFilter)
# crazy backwards compatibility goo: None for ok, list of problems
# if transaction didnt complete and empty list if it completed

View File

@ -139,7 +139,6 @@ struct rpmtsObject_s {
rpmts ts;
FD_t scriptFd;
rpmtsi tsi;
rpmprobFilterFlags ignoreSet;
};
struct rpmtsCallbackType_s {
@ -591,10 +590,11 @@ rpmts_Run(rpmtsObject * s, PyObject * args, PyObject * kwds)
{
int rc;
struct rpmtsCallbackType_s cbInfo;
char * kwlist[] = {"callback", "data", NULL};
rpmprobFilterFlags ignoreSet;
char * kwlist[] = {"callback", "data", "ignoreSet", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:Run", kwlist,
&cbInfo.cb, &cbInfo.data))
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOi:Run", kwlist,
&cbInfo.cb, &cbInfo.data, &ignoreSet))
return NULL;
cbInfo.tso = s;
@ -608,7 +608,7 @@ rpmts_Run(rpmtsObject * s, PyObject * args, PyObject * kwds)
(void) rpmtsSetNotifyCallback(s->ts, rpmtsCallback, (void *) &cbInfo);
}
rc = rpmtsRun(s->ts, NULL, s->ignoreSet);
rc = rpmtsRun(s->ts, NULL, ignoreSet);
if (cbInfo.cb)
(void) rpmtsSetNotifyCallback(s->ts, NULL, NULL);
@ -855,11 +855,6 @@ static PyObject *rpmts_get_vsflags(rpmtsObject *s, void *closure)
static char rpmts_doc[] =
"";
static PyMemberDef rpmts_members[] = {
{"_probFilter", T_INT, offsetof(rpmtsObject, ignoreSet), 0, NULL},
{NULL}
};
static PyGetSetDef rpmts_getseters[] = {
/* only provide a setter until we have rpmfd wrappings */
{"scriptFd", NULL, (setter)rpmts_set_scriptFd, NULL },
@ -902,7 +897,7 @@ PyTypeObject rpmts_Type = {
PyObject_SelfIter, /* tp_iter */
(iternextfunc) rpmts_iternext, /* tp_iternext */
rpmts_methods, /* tp_methods */
rpmts_members, /* tp_members */
0, /* tp_members */
rpmts_getseters, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */