Permit headerConvert() from python
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 23 Sep 2009 06:24:23 +0000 (09:24 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 23 Sep 2009 06:24:23 +0000 (09:24 +0300)
python/header-py.c
python/rpmmodule.c

index 739f858..f449fd2 100644 (file)
@@ -274,6 +274,17 @@ static PyObject *hdrHasKey(hdrObject *s, PyObject *pytag)
     return PyBool_FromLong(headerIsEntry(s->h, tag));
 }
 
+static PyObject *hdrConvert(hdrObject *self, PyObject *args, PyObject *kwds)
+{
+    char *kwlist[] = {"op", NULL};
+    headerConvOps op = -1;
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", kwlist, &op)) {
+        return NULL;
+    }
+    return PyBool_FromLong(headerConvert(self->h, op));
+}
+
 static int hdr_compare(hdrObject * a, hdrObject * b)
 {
     return rpmVersionCompare(a->h, b->h);
@@ -295,6 +306,8 @@ static struct PyMethodDef hdr_methods[] = {
        NULL },
     {"fullFilelist",   (PyCFunction) hdrFullFilelist,  METH_NOARGS,
        NULL },
+    {"convert",                (PyCFunction) hdrConvert,       METH_VARARGS|METH_KEYWORDS,
+       NULL },
     {"has_key",                (PyCFunction) hdrHasKey,        METH_O,
        NULL },
     {"sprintf",                (PyCFunction) hdrSprintf,       METH_VARARGS|METH_KEYWORDS,
index 37c7c3a..d43e89c 100644 (file)
@@ -438,5 +438,9 @@ void init_rpm(void)
     REGISTER_ENUM(TR_REMOVED);
 
     REGISTER_ENUM(RPMDBI_PACKAGES);
+
+    REGISTER_ENUM(HEADERCONV_EXPANDFILELIST);
+    REGISTER_ENUM(HEADERCONV_COMPRESSFILELIST);
+    REGISTER_ENUM(HEADERCONV_RETROFIT_V3);
 }