summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-09-01 08:31:04 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-09-01 08:31:04 +0300
commitf07ab5c1afa9b0b7105082a8617ec6a7657fc27e (patch)
treed17a8fa1c295ff48a6b31b7dd948b37b697dfc70 /python
parentcab09c6c36ddeec4da6f0f557afcd2028b38fa03 (diff)
downloadlibrpm-tizen-f07ab5c1afa9b0b7105082a8617ec6a7657fc27e.tar.gz
librpm-tizen-f07ab5c1afa9b0b7105082a8617ec6a7657fc27e.tar.bz2
librpm-tizen-f07ab5c1afa9b0b7105082a8617ec6a7657fc27e.zip
Add method to reset + reload rpm configuration to python bindings
Diffstat (limited to 'python')
-rw-r--r--python/rpmmodule.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index d3e664a2f..2894882b8 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -114,6 +114,22 @@ static PyObject * doLog(PyObject * self, PyObject * args, PyObject *kwds)
Py_RETURN_NONE;
}
+static PyObject * reloadConfig(PyObject * self, PyObject * args, PyObject *kwds)
+{
+ char * target = NULL;
+ char * kwlist[] = { "target", NULL };
+ int rc;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|s", kwlist, &target))
+ return NULL;
+
+ rpmFreeMacros(NULL);
+ rpmFreeRpmrc();
+ rc = rpmReadConfigFiles(NULL, target) ;
+
+ return PyBool_FromLong(rc == 0);
+}
+
static PyMethodDef rpmModuleMethods[] = {
{ "addMacro", (PyCFunction) rpmmacro_AddMacro, METH_VARARGS|METH_KEYWORDS,
NULL },
@@ -148,6 +164,8 @@ static PyMethodDef rpmModuleMethods[] = {
NULL },
{ "setStats", (PyCFunction) setStats, METH_O,
NULL },
+ { "reloadConfig", (PyCFunction) reloadConfig, METH_VARARGS|METH_KEYWORDS,
+ NULL },
{ NULL }
} ;