Rip out rhnLoad() and rhnUnload() from python bindings.
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 12 Jul 2007 12:46:31 +0000 (15:46 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 12 Jul 2007 12:46:31 +0000 (15:46 +0300)
Prehistoric, unused and vendor specific stuff... time to go.

python/header-py.c
python/header-py.h
python/rpmmodule.c

index a6901e3..709ecf2 100644 (file)
@@ -270,65 +270,6 @@ static void mungeFilelist(Header h)
     fileNames = _free(fileNames);
 }
 
-/**
- */
-static PyObject * rhnUnload(hdrObject * s)
-       /*@*/
-{
-    int len;
-    char * uh;
-    PyObject * rc;
-    Header h;
-
-    h = headerLink(s->h);
-
-    /* Retrofit a RHNPlatform: tag. */
-    if (!headerIsEntry(h, RPMTAG_RHNPLATFORM)) {
-       const char * arch;
-       int_32 at;
-       if (headerGetEntry(h, RPMTAG_ARCH, &at, (void **)&arch, NULL))
-           headerAddEntry(h, RPMTAG_RHNPLATFORM, at, arch, 1);
-    }
-
-    /* Legacy headers are forced into immutable region. */
-    if (!headerIsEntry(h, RPMTAG_HEADERIMMUTABLE)) {
-       Header nh = headerReload(h, RPMTAG_HEADERIMMUTABLE);
-       /* XXX Another unload/load cycle to "seal" the immutable region. */
-       uh = headerUnload(nh);
-       headerFree(nh);
-       h = headerLoad(uh);
-       headerAllocated(h);
-    }
-
-    /* All headers have SHA1 digest, compute and add if necessary. */
-    if (!headerIsEntry(h, RPMTAG_SHA1HEADER)) {
-       int_32 uht, uhc;
-       const char * digest;
-        size_t digestlen;
-        DIGEST_CTX ctx;
-
-       headerGetEntry(h, RPMTAG_HEADERIMMUTABLE, &uht, (void **)&uh, &uhc);
-
-       ctx = rpmDigestInit(PGPHASHALGO_SHA1, RPMDIGEST_NONE);
-        rpmDigestUpdate(ctx, uh, uhc);
-        rpmDigestFinal(ctx, (void **)&digest, &digestlen, 1);
-
-       headerAddEntry(h, RPMTAG_SHA1RHN, RPM_STRING_TYPE, digest, 1);
-
-       uh = headerFreeData(uh, uht);
-       digest = _free(digest);
-    }
-
-    len = headerSizeof(h, 0);
-    uh = headerUnload(h);
-    headerFree(h);
-
-    rc = PyString_FromStringAndSize(uh, len);
-    uh = _free(uh);
-
-    return rc;
-}
-
 /** \ingroup py_c
  */
 static PyObject * hdrFullFilelist(hdrObject * s)
@@ -393,8 +334,6 @@ static struct PyMethodDef hdr_methods[] = {
        NULL },
     {"fullFilelist",   (PyCFunction) hdrFullFilelist,  METH_NOARGS,
        NULL },
-    {"rhnUnload",      (PyCFunction) rhnUnload,        METH_NOARGS,
-       NULL },
     {"sprintf",                (PyCFunction) hdrSprintf,       METH_VARARGS|METH_KEYWORDS,
        NULL },
 
@@ -754,59 +693,6 @@ PyObject * hdrLoad(PyObject * self, PyObject * args, PyObject * kwds)
 
 /**
  */
-PyObject * rhnLoad(PyObject * self, PyObject * args, PyObject * kwds)
-{
-    char * obj, * copy=NULL;
-    Header h;
-    int len;
-    char * kwlist[] = {"headers", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "s#", kwlist, &obj, &len))
-       return NULL;
-
-    /* malloc is needed to avoid surprises from data swab in headerLoad(). */
-    copy = malloc(len);
-    if (copy == NULL) {
-       PyErr_SetString(pyrpmError, "out of memory");
-       return NULL;
-    }
-    memcpy (copy, obj, len);
-
-    h = headerLoad(copy);
-    if (!h) {
-       PyErr_SetString(pyrpmError, "bad header");
-       return NULL;
-    }
-    headerAllocated(h);
-
-    /* XXX avoid the false OK's from rpmverifyDigest() with missing tags. */
-    if (!headerIsEntry(h, RPMTAG_HEADERIMMUTABLE)) {
-       PyErr_SetString(pyrpmError, "bad header, not immutable");
-       headerFree(h);
-       return NULL;
-    }
-
-    /* XXX avoid the false OK's from rpmverifyDigest() with missing tags. */
-    if (!headerIsEntry(h, RPMTAG_SHA1HEADER)
-    &&  !headerIsEntry(h, RPMTAG_SHA1RHN)) {
-       PyErr_SetString(pyrpmError, "bad header, no digest");
-       headerFree(h);
-       return NULL;
-    }
-
-    /* Retrofit a RHNPlatform: tag. */
-    if (!headerIsEntry(h, RPMTAG_RHNPLATFORM)) {
-       const char * arch;
-       int_32 at;
-       if (headerGetEntry(h, RPMTAG_ARCH, &at, (void **)&arch, NULL))
-           headerAddEntry(h, RPMTAG_RHNPLATFORM, at, arch, 1);
-    }
-
-    return (PyObject *) hdr_Wrap(h);
-}
-
-/**
- */
 PyObject * rpmReadHeaders (FD_t fd)
 {
     PyObject * list;
index 49a2d06..7c470f0 100644 (file)
@@ -41,8 +41,6 @@ PyObject * rpmSingleHeaderFromFD(PyObject * self, PyObject * args, PyObject * kw
        /*@*/;
 PyObject * rpmReadHeaders (FD_t fd)
        /*@*/;
-PyObject * rhnLoad(PyObject * self, PyObject * args, PyObject * kwds)
-       /*@*/;
 PyObject * hdrLoad(PyObject * self, PyObject * args, PyObject * kwds)
        /*@*/;
 
index 9443e28..624dc2c 100644 (file)
@@ -148,8 +148,6 @@ static PyMethodDef rpmModuleMethods[] = {
 
     { "headerLoad", (PyCFunction) hdrLoad, METH_VARARGS|METH_KEYWORDS,
        NULL },
-    { "rhnLoad", (PyCFunction) rhnLoad, METH_VARARGS|METH_KEYWORDS,
-       NULL },
     { "mergeHeaderListFromFD", (PyCFunction) rpmMergeHeadersFromFD, METH_VARARGS|METH_KEYWORDS,
        NULL },
     { "readHeaderListFromFD", (PyCFunction) rpmHeaderFromFD, METH_VARARGS|METH_KEYWORDS,