diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-10-09 09:30:37 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-10-09 09:30:37 +0300 |
commit | 121ea41e33d19e415302c66e842a228212d80c22 (patch) | |
tree | ddb1b51f11033e5e427a082c97dbe5852abe0865 /python/rpmts-py.c | |
parent | 62888020f4ce618c447115e4b52015e4f7402f30 (diff) | |
download | librpm-tizen-121ea41e33d19e415302c66e842a228212d80c22.tar.gz librpm-tizen-121ea41e33d19e415302c66e842a228212d80c22.tar.bz2 librpm-tizen-121ea41e33d19e415302c66e842a228212d80c22.zip |
Permit setting and getting ts keyring from python
Diffstat (limited to 'python/rpmts-py.c')
-rw-r--r-- | python/rpmts-py.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 001266097..c1c9779c3 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -9,6 +9,7 @@ #include "header-py.h" #include "rpmds-py.h" /* XXX for rpmdsNew */ #include "rpmfd-py.h" +#include "rpmkeyring-py.h" #include "rpmfi-py.h" /* XXX for rpmfiNew */ #include "rpmmi-py.h" #include "rpmps-py.h" @@ -420,6 +421,29 @@ rpmts_PgpImportPubkey(rpmtsObject * s, PyObject * args, PyObject * kwds) return Py_BuildValue("i", rc); } +static PyObject *rpmts_setKeyring(rpmtsObject *s, PyObject *arg) +{ + rpmKeyring keyring = NULL; + if (!PyArg_Parse(arg, "O&", rpmKeyringFromPyObject, &keyring)) + return NULL; + + return PyBool_FromLong(rpmtsSetKeyring(s->ts, keyring) == 0); +} + +static PyObject *rpmts_getKeyring(rpmtsObject *s, PyObject *args, PyObject *kwds) +{ + rpmKeyring keyring = NULL; + int autoload = 1; + char * kwlist[] = { "autoload", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i:getKeyring", + kwlist, &autoload)) + return NULL; + + keyring = rpmtsGetKeyring(s->ts, autoload); + return rpmKeyring_Wrap(&rpmKeyring_Type, keyring); +} + static void * rpmtsCallback(const void * hd, const rpmCallbackType what, const rpm_loff_t amount, const rpm_loff_t total, @@ -632,6 +656,10 @@ static struct PyMethodDef rpmts_methods[] = { NULL }, {"pgpImportPubkey", (PyCFunction) rpmts_PgpImportPubkey, METH_VARARGS|METH_KEYWORDS, NULL }, + {"getKeyring", (PyCFunction) rpmts_getKeyring, METH_VARARGS|METH_KEYWORDS, + NULL }, + {"setKeyring", (PyCFunction) rpmts_setKeyring, METH_O, + NULL }, {"dbMatch", (PyCFunction) rpmts_Match, METH_VARARGS|METH_KEYWORDS, "ts.dbMatch([TagN, [key, [len]]]) -> mi\n\ - Create a match iterator for the default transaction rpmdb.\n" }, |