return _createrepo_c.xml_from_rpm(filename, checksum_type,
location_href, location_base, changelog_limit)
-xml_dump_primary = _createrepo_c.xml_dump_primary
-xml_dump_filelists = _createrepo_c.xml_dump_filelists
-xml_dump_other = _createrepo_c.xml_dump_other
-xml_dump = _createrepo_c.xml_dump
+xml_dump_primary = _createrepo_c.xml_dump_primary
+xml_dump_filelists = _createrepo_c.xml_dump_filelists
+xml_dump_other = _createrepo_c.xml_dump_other
+xml_dump_updaterecord = _createrepo_c.xml_dump_updaterecord
+xml_dump = _createrepo_c.xml_dump
def xml_parse_primary(path, newpkgcb=None, pkgcb=None,
warningcb=None, do_files=1):
METH_VARARGS, xml_dump_filelists__doc__},
{"xml_dump_other", (PyCFunction)py_xml_dump_other,
METH_VARARGS, xml_dump_other__doc__},
+ {"xml_dump_updaterecord", (PyCFunction)py_xml_dump_updaterecord,
+ METH_VARARGS, xml_dump_updaterecord__doc__},
{"xml_dump", (PyCFunction)py_xml_dump,
METH_VARARGS, xml_dump__doc__},
{"xml_parse_primary", (PyCFunction)py_xml_parse_primary,
#include "typeconversion.h"
#include "package-py.h"
#include "exception-py.h"
+#include "updaterecord-py.h"
PyObject *
py_xml_dump_primary(PyObject *self, PyObject *args)
return tuple;
}
+
+PyObject *
+py_xml_dump_updaterecord(PyObject *self, PyObject *args)
+{
+ PyObject *py_rec, *py_str;
+ char *xml;
+ GError *err = NULL;
+
+ CR_UNUSED(self);
+
+ if (!PyArg_ParseTuple(args, "O!:py_xml_dump_updaterecord",
+ &UpdateRecord_Type, &py_rec))
+ return NULL;
+
+ xml = cr_xml_dump_updaterecord(UpdateRecord_FromPyObject(py_rec), &err);
+ if (err) {
+ nice_exception(&err, NULL);
+ return NULL;
+ }
+
+ py_str = PyStringOrNone_FromString(xml);
+ free(xml);
+ return py_str;
+}
PyObject *py_xml_dump(PyObject *self, PyObject *args);
+PyDoc_STRVAR(xml_dump_updaterecord__doc__,
+"xml_dump_updaterecord(pkg) -> str\n\n"
+"Generate xml chunk from UpdateRecord");
+
+PyObject *py_xml_dump_updaterecord(PyObject *self, PyObject *args);
+
#endif
* @param err **GError
* @return xml chunk string or NULL on error
*/
-char *cr_xml_dump_updateinforecord(cr_UpdateRecord *rec, GError **err);
+char *cr_xml_dump_updaterecord(cr_UpdateRecord *rec, GError **err);
/** Generate xml representation of cr_DeltaPackage
* @param dpkg cr_DeltaPackage
}
char *
-cr_xml_dump_updateinforecord(cr_UpdateRecord *rec, GError **err)
+cr_xml_dump_updaterecord(cr_UpdateRecord *rec, GError **err)
{
xmlNodePtr root;
char *result;
self.assertEqual(col.name, "long name")
self.assertEqual(len(col.packages), 0)
+ def test_xml_dump_updaterecord(self):
+ rec = cr.UpdateRecord()
+ rec.fromstr = "from"
+ rec.status = "status"
+ rec.type = "type"
+ rec.version = "version"
+ rec.id = "id"
+ rec.title = "title"
+ rec.issued_date = "issued_date"
+ rec.updated_date = "updated_date"
+ rec.rights = "rights"
+ rec.release = "release"
+ rec.pushcount = "pushcount"
+ rec.severity = "severity"
+ rec.summary = "summary"
+ rec.description = "description"
+ rec.solution = "solution"
+
+ xml = cr.xml_dump_updaterecord(rec)
+ self.assertEqual(xml,
+""" <delta>
+ <update from="from" status="status" type="type" version="version">
+ <id>id</id>
+ <title>title</title>
+ <issued date="issued_date"/>
+ <updated date="updated_date"/>
+ <rights>rights</rights>
+ <release>release</release>
+ <pushcount>pushcount</pushcount>
+ <severity>severity</severity>
+ <summary>summary</summary>
+ <description>description</description>
+ <solution>solution</solution>
+ <references/>
+ <pkglist/>
+ </update>
+ </delta>
+""")