diff options
author | msw <devnull@localhost> | 2000-02-11 21:06:10 +0000 |
---|---|---|
committer | msw <devnull@localhost> | 2000-02-11 21:06:10 +0000 |
commit | eebe8047cced799ccff013be9318756349777ad0 (patch) | |
tree | 70a06cf1c20e3b9931bee80dfa0da092e36e6b70 /python | |
parent | d54a9c27932856619af3dc87fef98d9af0b62df2 (diff) | |
download | rpm-eebe8047cced799ccff013be9318756349777ad0.tar.gz rpm-eebe8047cced799ccff013be9318756349777ad0.tar.bz2 rpm-eebe8047cced799ccff013be9318756349777ad0.zip |
add a method to fill the filelist fully
CVS patchset: 3553
CVS date: 2000/02/11 21:06:10
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmmodule.c | 31 | ||||
-rwxr-xr-x | python/testhdr | 15 |
2 files changed, 45 insertions, 1 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c index ba24c6449..c0104516e 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -42,6 +42,7 @@ 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); +static PyObject * hdrFullFilelist(hdrObject * s, PyObject * args); void initrpm(void); static PyObject * doAddMacro(PyObject * self, PyObject * args); @@ -210,6 +211,7 @@ static struct PyMethodDef hdrMethods[] = { {"verifyFile", (PyCFunction) hdrVerifyFile, 1 }, {"expandFilelist", (PyCFunction) hdrExpandFilelist, 1 }, {"compressFilelist", (PyCFunction) hdrCompressFilelist, 1 }, + {"fullFilelist", (PyCFunction) hdrFullFilelist, 1 }, {NULL, NULL} /* sentinel */ }; @@ -361,6 +363,28 @@ void initrpm(void) { PyInt_FromLong(RPMPROB_DISKSPACE)); } +/* make a header with _all_ the tags we need */ +void mungeFilelist(Header h) +{ + const char ** fileNames = NULL; + int count = 0; + + if (!headerIsEntry (h, RPMTAG_BASENAMES) + || !headerIsEntry (h, RPMTAG_DIRNAMES) + || !headerIsEntry (h, RPMTAG_DIRINDEXES)) + compressFilelist(h); + + rpmBuildFileList(h, &fileNames, &count); + + if (fileNames == NULL || count <= 0) + return; + + headerAddEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE, + fileNames, count); + + xfree(fileNames); +} + static int psGetArchScore(Header h) { void * pkgArch; @@ -1281,6 +1305,13 @@ static PyObject * hdrExpandFilelist(hdrObject * s, PyObject * args) { return Py_None; } +static PyObject * hdrFullFilelist(hdrObject * s, PyObject * args) { + mungeFilelist (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 index d209bee38..f1b8150b5 100755 --- a/python/testhdr +++ b/python/testhdr @@ -21,11 +21,24 @@ rc = db.findbyname('redhat-release') h = db[rc[0]] printlist (h, 'filenames') printlist (h, 'oldfilenames') -h.expandFilelist() + print "-------------- expand --------------------" +h.expandFilelist() printlist (h, 'oldfilenames') printlist (h, 'filenames') + print "-------------- compress --------------------" h.compressFilelist() printlist (h, 'oldfilenames') printlist (h, 'filenames') + +print "-------------- expand --------------------" +h.expandFilelist() +printlist (h, 'oldfilenames') +printlist (h, 'filenames') + +print "-------------- full --------------------" +h.fullFilelist() +printlist (h, 'oldfilenames') +printlist (h, 'filenames') + |