summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsw <devnull@localhost>2000-08-23 22:53:05 +0000
committermsw <devnull@localhost>2000-08-23 22:53:05 +0000
commitcd05426202e9348de5ba3490991688a7f0abc81a (patch)
treedf760141de0448424a23085d0dc490e2ba988f65
parente3e8daa4315b6e280c840eca029872034037c4e1 (diff)
downloadlibrpm-tizen-cd05426202e9348de5ba3490991688a7f0abc81a.tar.gz
librpm-tizen-cd05426202e9348de5ba3490991688a7f0abc81a.tar.bz2
librpm-tizen-cd05426202e9348de5ba3490991688a7f0abc81a.zip
added a hack to get the header that was passed to the transaction callback marshaller but not passed as arguments to the python callback
CVS patchset: 4112 CVS date: 2000/08/23 22:53:05
-rw-r--r--python/rpmmodule.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index 405a570c8..2fb918589 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -88,6 +88,9 @@ static int rpmtransSetAttr(rpmtransObject * o, char * name,
/* signature verification */
static PyObject * checkSig (PyObject * self, PyObject * args);
+/* hack to get the current header that's in the transaction set */
+static PyObject * getTsHeader (PyObject * self, PyObject * args);
+
/* internal functions */
static long tagNumFromPyObject (PyObject *item);
static void mungeFilelist(Header h);
@@ -132,6 +135,7 @@ struct hdrObject_s {
/* Data */
static PyObject * pyrpmError;
+static Header transactionSetHeader;
static PyMethodDef rpmModuleMethods[] = {
{ "TransactionSet", (PyCFunction) rpmtransCreate, METH_VARARGS, NULL },
@@ -150,6 +154,7 @@ static PyMethodDef rpmModuleMethods[] = {
{ "versionCompare", (PyCFunction) versionCompare, METH_VARARGS, NULL },
{ "labelCompare", (PyCFunction) labelCompare, METH_VARARGS, NULL },
{ "checksig", (PyCFunction) checkSig, METH_VARARGS, NULL },
+ { "getTransactionCallbackHeader", (PyCFunction) getTsHeader, METH_VARARGS, NULL },
/* { "Fopen", (PyCFunction) doFopen, METH_VARARGS, NULL }, */
{ NULL }
} ;
@@ -1648,6 +1653,8 @@ struct tsCallbackType {
int pythonError;
};
+
+
static void * tsCallback(const Header h, const rpmCallbackType what,
const unsigned long amount, const unsigned long total,
const void * pkgKey, void * data) {
@@ -1659,6 +1666,7 @@ static void * tsCallback(const Header h, const rpmCallbackType what,
if (cbInfo->pythonError) return NULL;
if (!pkgKey) pkgKey = Py_None;
+ transactionSetHeader = h;
args = Py_BuildValue("(illOO)", what, amount, total, pkgKey, cbInfo->data);
result = PyEval_CallObject(cbInfo->cb, args);
@@ -1825,6 +1833,20 @@ static PyObject * checkSig (PyObject * self, PyObject * args) {
return Py_BuildValue("i", rc);
}
+
+static PyObject * getTsHeader (PyObject * self, PyObject * args) {
+ hdrObject * h;
+
+ h = (hdrObject *) PyObject_NEW(PyObject, &hdrType);
+ h->h = transactionSetHeader;
+ h->sigs = NULL;
+ h->fileList = h->linkList = h->md5list = NULL;
+ h->uids = h->gids = h->mtimes = h->fileSizes = NULL;
+ h->modes = h->rdevs = NULL;
+
+ return h;
+}
+
/* disable
static PyObject * doFopen(PyObject * self, PyObject * args) {
char * path, * mode;