diff options
author | msw <devnull@localhost> | 2000-02-11 20:29:22 +0000 |
---|---|---|
committer | msw <devnull@localhost> | 2000-02-11 20:29:22 +0000 |
commit | d54a9c27932856619af3dc87fef98d9af0b62df2 (patch) | |
tree | d58e23d50526b2c1572f488942efdd949ea8bf39 /python | |
parent | f35fa76d2d73af0d33289b463328391333b64114 (diff) | |
download | rpm-d54a9c27932856619af3dc87fef98d9af0b62df2.tar.gz rpm-d54a9c27932856619af3dc87fef98d9af0b62df2.tar.bz2 rpm-d54a9c27932856619af3dc87fef98d9af0b62df2.zip |
add compress/uncompress filelist
CVS patchset: 3552
CVS date: 2000/02/11 20:29:22
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmmodule.c | 19 | ||||
-rwxr-xr-x | python/testhdr | 31 |
2 files changed, 50 insertions, 0 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c index 888adc9f2..ba24c6449 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -9,6 +9,7 @@ #include "Python.h" #include "rpmlib.h" +#include "misc.h" #include "rpmmacro.h" #include "upgrade.h" @@ -39,6 +40,8 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item); static PyObject * hdrKeyList(hdrObject * s, PyObject * args); static PyObject * hdrUnload(hdrObject * s, PyObject * args); static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args); +static PyObject * hdrCompressFilelist(hdrObject * s, PyObject * args); +static PyObject * hdrExpandFilelist(hdrObject * s, PyObject * args); void initrpm(void); static PyObject * doAddMacro(PyObject * self, PyObject * args); @@ -205,6 +208,8 @@ static struct PyMethodDef hdrMethods[] = { {"keys", (PyCFunction) hdrKeyList, 1 }, {"unload", (PyCFunction) hdrUnload, 1 }, {"verifyFile", (PyCFunction) hdrVerifyFile, 1 }, + {"expandFilelist", (PyCFunction) hdrExpandFilelist, 1 }, + {"compressFilelist", (PyCFunction) hdrCompressFilelist, 1 }, {NULL, NULL} /* sentinel */ }; @@ -1262,6 +1267,20 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { return list; } +static PyObject * hdrCompressFilelist(hdrObject * s, PyObject * args) { + compressFilelist (s->h); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyObject * hdrExpandFilelist(hdrObject * s, PyObject * args) { + expandFilelist (s->h); + + Py_INCREF(Py_None); + return Py_None; +} + static PyObject * rpmtransCreate(PyObject * self, PyObject * args) { rpmtransObject * o; rpmdbObject * db = NULL; diff --git a/python/testhdr b/python/testhdr new file mode 100755 index 000000000..d209bee38 --- /dev/null +++ b/python/testhdr @@ -0,0 +1,31 @@ +#!/usr/bin/python + +import rpm + +def printlist(h, tag): + print "####### %s tag contains:" % tag + i = 0 + list = h[tag] + if not list: + print "NO SUCH TAG" + return + + for file in list: + print file + i = i + 1 + print "******** %d files" % i + + +db = rpm.opendb(0) +rc = db.findbyname('redhat-release') +h = db[rc[0]] +printlist (h, 'filenames') +printlist (h, 'oldfilenames') +h.expandFilelist() +print "-------------- expand --------------------" +printlist (h, 'oldfilenames') +printlist (h, 'filenames') +print "-------------- compress --------------------" +h.compressFilelist() +printlist (h, 'oldfilenames') +printlist (h, 'filenames') |