Deprecate header filelist munging methods
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 23 Sep 2009 06:56:08 +0000 (09:56 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 23 Sep 2009 06:56:08 +0000 (09:56 +0300)
- hdr.convert() is the generic way, the old stuff is not needed anymore
- macro to issue warnings just once

python/header-py.c

index b2f93a6..b8943a0 100644 (file)
  * \name Class: rpm.hdr
  */
 
+#define DEPRECATED_METHOD \
+    static int _warn = 0; \
+    if (!_warn) PyErr_Warn(PyExc_DeprecationWarning, "method is deprecated"); \
+    _warn = 1;
+
 struct hdrObject_s {
     PyObject_HEAD
     Header h;
@@ -200,6 +205,7 @@ static PyObject * hdrUnload(hdrObject * s, PyObject * args, PyObject *keywords)
 
 static PyObject * hdrExpandFilelist(hdrObject * s)
 {
+    DEPRECATED_METHOD;
     headerConvert(s->h, HEADERCONV_EXPANDFILELIST);
 
     Py_RETURN_NONE;
@@ -207,6 +213,7 @@ static PyObject * hdrExpandFilelist(hdrObject * s)
 
 static PyObject * hdrCompressFilelist(hdrObject * s)
 {
+    DEPRECATED_METHOD;
     headerConvert(s->h, HEADERCONV_COMPRESSFILELIST);
 
     Py_RETURN_NONE;
@@ -218,6 +225,7 @@ static PyObject * hdrFullFilelist(hdrObject * s)
     rpmtd fileNames = rpmtdNew();
     Header h = s->h;
 
+    DEPRECATED_METHOD;
     if (!headerIsEntry (h, RPMTAG_BASENAMES)
        || !headerIsEntry (h, RPMTAG_DIRNAMES)
        || !headerIsEntry (h, RPMTAG_DIRINDEXES))