* print header['name']
* \endcode
* This method of access is a bit slower because the name must be
- * translated into the tag number dynamically.
+ * translated into the tag number dynamically. You also must make sure
+ * the strings in header lookups don't get translated, or the lookups
+ * will fail.
*/
/** \ingroup python
/** \ingroup python
*/
static PyObject * hdrFullFilelist(hdrObject * s, PyObject * args) {
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
mungeFilelist (s->h);
Py_INCREF(Py_None);
/** \ingroup python
*/
+static PyObject * hdrSprintf(hdrObject * s, PyObject * args) {
+ char * fmt;
+ char * r;
+ errmsg_t err;
+ PyObject * result;
+
+ if (!PyArg_ParseTuple(args, "s", &fmt))
+ return NULL;
+
+ r = headerSprintf(s->h, fmt, rpmTagTable, rpmHeaderFormats, &err);
+ if (!r) {
+ PyErr_SetString(pyrpmError, err);
+ return NULL;
+ }
+
+ result = Py_BuildValue("s", r);
+ free(r);
+
+ return result;
+}
+
+
+/** \ingroup python
+ */
static struct PyMethodDef hdrMethods[] = {
{"keys", (PyCFunction) hdrKeyList, 1 },
{"unload", (PyCFunction) hdrUnload, METH_VARARGS|METH_KEYWORDS },
{"compressFilelist", (PyCFunction) hdrCompressFilelist, 1 },
{"fullFilelist", (PyCFunction) hdrFullFilelist, 1 },
{"rhnUnload", (PyCFunction) rhnUnload, METH_VARARGS },
+ {"sprintf", (PyCFunction) hdrSprintf, METH_VARARGS },
{NULL, NULL} /* sentinel */
};
*/
static PyObject * getTsHeader (PyObject * self, PyObject * args) {
hdrObject * h;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
if (transactionSetHeader) {
h = (hdrObject *) PyObject_NEW(PyObject, &hdrType);
return (PyObject *) Py_None;
}
+static PyObject * setVerbosity (PyObject * self, PyObject * args) {
+ int level;
+
+ if (!PyArg_ParseTuple(args, "i", &level))
+ return NULL;
+
+ rpmSetVerbosity(level);
+
+ Py_INCREF(Py_None);
+ return (PyObject *) Py_None;
+}
+
/**
*/
typedef struct FDlist_t FDlist;
{ "labelCompare", (PyCFunction) labelCompare, METH_VARARGS, NULL },
{ "checksig", (PyCFunction) checkSig, METH_VARARGS, NULL },
{ "getTransactionCallbackHeader", (PyCFunction) getTsHeader, METH_VARARGS, NULL },
-/* { "Fopen", (PyCFunction) doFopen, METH_VARARGS, NULL }, */
+ { "Fopen", (PyCFunction) doFopen, METH_VARARGS, NULL },
+ { "setVerbosity", (PyCFunction) setVerbosity, METH_VARARGS, NULL },
{ NULL }
} ;
REGISTER_ENUM(VERIFY_DIGEST);
REGISTER_ENUM(VERIFY_SIGNATURE);
#endif
+
+ REGISTER_ENUM(RPMLOG_EMERG);
+ REGISTER_ENUM(RPMLOG_ALERT);
+ REGISTER_ENUM(RPMLOG_CRIT);
+ REGISTER_ENUM(RPMLOG_ERR);
+ REGISTER_ENUM(RPMLOG_WARNING);
+ REGISTER_ENUM(RPMLOG_NOTICE);
+ REGISTER_ENUM(RPMLOG_INFO);
+ REGISTER_ENUM(RPMLOG_DEBUG);
+
}
/*@}*/