diff options
author | jbj <devnull@localhost> | 1999-10-27 23:18:10 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-10-27 23:18:10 +0000 |
commit | 0d0b405c201b43f2eebc61257f5992931e1cdb0c (patch) | |
tree | 7b19eee73f74dbd86e65255cff8be16b58292035 /python | |
parent | 82c75cb6a261465700ca469793b54ad68bef99a8 (diff) | |
download | librpm-tizen-0d0b405c201b43f2eebc61257f5992931e1cdb0c.tar.gz librpm-tizen-0d0b405c201b43f2eebc61257f5992931e1cdb0c.tar.bz2 librpm-tizen-0d0b405c201b43f2eebc61257f5992931e1cdb0c.zip |
use compressed filenames on install side.
start unifying FD types, CFD_t now gone.
CVS patchset: 3402
CVS date: 1999/10/27 23:18:10
Diffstat (limited to 'python')
-rw-r--r-- | python/rpmmodule.c | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c index d2e3631b7..d32f636a5 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -60,7 +60,7 @@ static PyObject * rpmtransRun(rpmtransObject * s, PyObject * args); static PyObject * rpmtransOrder(rpmtransObject * s, PyObject * args); static void rpmtransDealloc(PyObject * o); static PyObject * rpmtransGetAttr(rpmtransObject * o, char * name); -static int rpmtransSetAttr(rpmtransObject * o, char * name, +static int rpmtransSetAttr(rpmtransObject * o, char * name, PyObject * val); /* Types */ @@ -74,7 +74,7 @@ static PyMethodDef rpmModuleMethods[] = { { "headerLoad", (PyCFunction) hdrLoad, METH_VARARGS, NULL }, { "opendb", (PyCFunction) rpmOpenDB, METH_VARARGS, NULL }, { "rebuilddb", (PyCFunction) rebuildDB, METH_VARARGS, NULL }, - { "readHeaderListFromFD", (PyCFunction) rpmHeaderFromFD, METH_VARARGS, NULL }, + { "readHeaderListFromFD", (PyCFunction) rpmHeaderFromFD, METH_VARARGS, NULL }, { "readHeaderListFromFile", (PyCFunction) rpmHeaderFromFile, METH_VARARGS, NULL }, { "errorSetCallback", (PyCFunction) errorSetCallback, METH_VARARGS, NULL }, { "errorString", (PyCFunction) errorString, METH_VARARGS, NULL }, @@ -202,7 +202,7 @@ static struct PyMethodDef hdrMethods[] = { /* External functions */ int mdfile(const char *fn, unsigned char *digest); - + /* Code */ void initrpm(void) { @@ -228,22 +228,22 @@ void initrpm(void) { PyDict_SetItemString(d, "tagnames", dict); - PyDict_SetItemString(d, "RPMFILE_STATE_NORMAL", + PyDict_SetItemString(d, "RPMFILE_STATE_NORMAL", PyInt_FromLong(RPMFILE_STATE_NORMAL)); - PyDict_SetItemString(d, "RPMFILE_STATE_REPLACED", + PyDict_SetItemString(d, "RPMFILE_STATE_REPLACED", PyInt_FromLong(RPMFILE_STATE_REPLACED)); - PyDict_SetItemString(d, "RPMFILE_STATE_NOTINSTALLED", + PyDict_SetItemString(d, "RPMFILE_STATE_NOTINSTALLED", PyInt_FromLong(RPMFILE_STATE_NOTINSTALLED)); - PyDict_SetItemString(d, "RPMFILE_CONFIG", + PyDict_SetItemString(d, "RPMFILE_CONFIG", PyInt_FromLong(RPMFILE_CONFIG)); PyDict_SetItemString(d, "RPMFILE_MISSINGOK", PyInt_FromLong(RPMFILE_MISSINGOK)); - PyDict_SetItemString(d, "RPMFILE_DOC", + PyDict_SetItemString(d, "RPMFILE_DOC", PyInt_FromLong(RPMFILE_DOC)); - PyDict_SetItemString(d, "RPMDEP_SENSE_REQUIRES", + PyDict_SetItemString(d, "RPMDEP_SENSE_REQUIRES", PyInt_FromLong(RPMDEP_SENSE_REQUIRES)); - PyDict_SetItemString(d, "RPMDEP_SENSE_CONFLICTS", + PyDict_SetItemString(d, "RPMDEP_SENSE_CONFLICTS", PyInt_FromLong(RPMDEP_SENSE_CONFLICTS)); PyDict_SetItemString(d, "RPMSENSE_SERIAL", @@ -421,12 +421,12 @@ static PyObject * findUpgradeSet(PyObject * self, PyObject * args) { list.packages[i]->selected = 0; list.packages[i]->data = hdr; - headerGetEntry(hdr->h, RPMTAG_NAME, NULL, + headerGetEntry(hdr->h, RPMTAG_NAME, NULL, (void **) &list.packages[i]->name, NULL); } pkgSort (&list); - + if (ugFindUpgradePackages(&list, root)) { PyErr_SetString(pyrpmError, "error during upgrade check"); return NULL; @@ -457,7 +457,7 @@ static rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) { char * errmsg = "cannot open database in %s"; char * errstr = NULL; int errsize; - + Py_DECREF(o); /* PyErr_SetString should take varargs... */ errsize = strlen(errmsg) + *root == '\0' ? 15 /* "/var/lib/rpm" */ : strlen(root); @@ -518,12 +518,12 @@ static PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args) { FD_t fd; int fileno; PyObject * list; - + if (!PyArg_ParseTuple(args, "i", &fileno)) return NULL; fd = fdDup(fileno); - + list = rpmReadHeaders (fd); - fdClose(fd); + Fclose(fd); return list; } @@ -548,7 +548,7 @@ static PyObject * hdrLoad(PyObject * self, PyObject * args) { h->fileList = h->linkList = h->md5list = NULL; h->uids = h->gids = h->mtimes = h->fileSizes = NULL; h->modes = h->rdevs = NULL; - + return (PyObject *) h; } @@ -566,8 +566,8 @@ static PyObject * rpmHeaderFromFile(PyObject * self, PyObject * args) { } list = rpmReadHeaders (fd); - fdClose(fd); - + Fclose(fd); + return list; } @@ -577,7 +577,7 @@ static void errorcb (void) { PyObject * result, * args = NULL; - if (errorData) + if (errorData) args = Py_BuildValue("(O)", errorData); result = PyEval_CallObject(errorCB, args); @@ -602,15 +602,15 @@ static PyObject * errorSetCallback (PyObject * self, PyObject * args) { } if (!PyArg_ParseTuple(args, "O|O", &errorCB, &errorData)) return NULL; - + if (!PyCallable_Check (errorCB)) { PyErr_SetString(PyExc_TypeError, "parameter must be callable"); return NULL; - } + } Py_INCREF (errorCB); Py_XINCREF (errorData); - + rpmErrorSetCallback (errorcb); Py_INCREF(Py_None); @@ -623,7 +623,7 @@ static PyObject * errorString (PyObject * self, PyObject * args) { static PyObject * versionCompare (PyObject * self, PyObject * args) { hdrObject * h1, * h2; - + if (!PyArg_ParseTuple(args, "O!O!", &hdrType, &h1, &hdrType, &h2)) return NULL; return Py_BuildValue("i", rpmVersionCompare(h1->h, h2->h)); @@ -639,7 +639,7 @@ static PyObject * labelCompare (PyObject * self, PyObject * args) { if (e1 && !e2) return Py_BuildValue("i", 1); - else if (!e1 && e2) + else if (!e1 && e2) return Py_BuildValue("i", -1); else if (e1 && e2) { int ep1, ep2; @@ -650,7 +650,7 @@ static PyObject * labelCompare (PyObject * self, PyObject * args) { else if (ep1 > ep2) return Py_BuildValue("i", 1); } - + rc = rpmvercmp(v1, v2); if (rc) return Py_BuildValue("i", rc); @@ -670,7 +670,7 @@ static PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) { fd = fdDup(rawFd); rc = rpmReadPackageHeader(fd, &header, &isSource, NULL, NULL); - fdClose(fd); + Fclose(fd); switch (rc) { case 0: @@ -808,7 +808,7 @@ static int rpmdbLength(rpmdbObject * s) { static hdrObject * rpmdbSubscript(rpmdbObject * s, PyObject * key) { int offset; hdrObject * h; - + if (!PyInt_Check(key)) { PyErr_SetString(PyExc_TypeError, "integer expected"); return NULL; @@ -827,7 +827,7 @@ static hdrObject * rpmdbSubscript(rpmdbObject * s, PyObject * key) { PyErr_SetString(pyrpmError, "cannot read rpmdb entry"); return NULL; } - + return h; } @@ -872,7 +872,7 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) { } switch (tag) { - case RPMTAG_FILENAMES: + case RPMTAG_OLDFILENAMES: case RPMTAG_FILESIZES: case RPMTAG_FILESTATES: case RPMTAG_FILEMODES: @@ -952,7 +952,7 @@ static PyObject * hdrSubscript(hdrObject * s, PyObject * item) { case RPM_STRING_TYPE: if (count != 1 || forceArray) { stringArray = data; - + metao = PyList_New(0); for (i=0; i < count; i++) { o = PyString_FromString(stringArray[i]); @@ -1009,7 +1009,7 @@ static PyObject * hdrUnload(hdrObject * s, PyObject * args) { len = headerSizeof(s->h, 0); buf = headerUnload(s->h); - + rc = PyString_FromStringAndSize(buf, len); free(buf); @@ -1050,7 +1050,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { if (!verifyResult) return list; if (!s->fileList) { - headerGetEntry(s->h, RPMTAG_FILENAMES, &type, (void **) &s->fileList, + headerGetEntry(s->h, RPMTAG_OLDFILENAMES, &type, (void **) &s->fileList, &count); } @@ -1058,14 +1058,14 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { if (verifyResult & RPMVERIFY_MD5) { if (!s->md5list) { - headerGetEntry(s->h, RPMTAG_FILEMD5S, &type, (void **) &s->md5list, + headerGetEntry(s->h, RPMTAG_FILEMD5S, &type, (void **) &s->md5list, &count); } - + if (mdfile(s->fileList[fileNumber], buf)) { strcpy(buf, "(unknown)"); - } - + } + tuple = PyTuple_New(3); attrName = PyString_FromString("checksum"); PyTuple_SetItem(tuple, 0, attrName); @@ -1076,7 +1076,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { if (verifyResult & RPMVERIFY_FILESIZE) { if (!s->fileSizes) { - headerGetEntry(s->h, RPMTAG_FILESIZES, &type, (void **) &s->fileSizes, + headerGetEntry(s->h, RPMTAG_FILESIZES, &type, (void **) &s->fileSizes, &count); } @@ -1094,7 +1094,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { if (verifyResult & RPMVERIFY_LINKTO) { if (!s->linkList) { - headerGetEntry(s->h, RPMTAG_FILELINKTOS, &type, (void **) &s->linkList, + headerGetEntry(s->h, RPMTAG_FILELINKTOS, &type, (void **) &s->linkList, &count); } @@ -1114,7 +1114,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { if (verifyResult & RPMVERIFY_MTIME) { if (!s->mtimes) { - headerGetEntry(s->h, RPMTAG_FILEMTIMES, &type, (void **) &s->mtimes, + headerGetEntry(s->h, RPMTAG_FILEMTIMES, &type, (void **) &s->mtimes, &count); } @@ -1138,7 +1138,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { if (verifyResult & RPMVERIFY_RDEV) { if (!s->rdevs) { - headerGetEntry(s->h, RPMTAG_FILERDEVS, &type, (void **) &s->rdevs, + headerGetEntry(s->h, RPMTAG_FILERDEVS, &type, (void **) &s->rdevs, &count); } @@ -1157,7 +1157,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { doesn't do these correctly either. At least this is consisten */ if (verifyResult & RPMVERIFY_USER) { if (!s->uids) { - headerGetEntry(s->h, RPMTAG_FILEUIDS, &type, (void **) &s->uids, + headerGetEntry(s->h, RPMTAG_FILEUIDS, &type, (void **) &s->uids, &count); } @@ -1173,7 +1173,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { if (verifyResult & RPMVERIFY_GROUP) { if (!s->gids) { - headerGetEntry(s->h, RPMTAG_FILEGIDS, &type, (void **) &s->gids, + headerGetEntry(s->h, RPMTAG_FILEGIDS, &type, (void **) &s->gids, &count); } @@ -1189,7 +1189,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) { if (verifyResult & RPMVERIFY_MODE) { if (!s->modes) { - headerGetEntry(s->h, RPMTAG_FILEMODES, &type, (void **) &s->modes, + headerGetEntry(s->h, RPMTAG_FILEMODES, &type, (void **) &s->modes, &count); } @@ -1235,7 +1235,7 @@ static void rpmtransDealloc(PyObject * o) { if (trans->dbo) { Py_DECREF(trans->dbo); } - if (trans->scriptFd) fdClose(trans->scriptFd); + if (trans->scriptFd) Fclose(trans->scriptFd); /* this will free the keyList, and decrement the ref count of all the items on the list as well :-) */ Py_DECREF(trans->keyList); @@ -1318,10 +1318,10 @@ static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) { list = PyList_New(0); for (i = 0; i < numConflicts; i++) { - cf = Py_BuildValue("((sss)(ss)iOi)", conflicts[i].byName, + cf = Py_BuildValue("((sss)(ss)iOi)", conflicts[i].byName, conflicts[i].byVersion, conflicts[i].byRelease, - conflicts[i].needsName, + conflicts[i].needsName, conflicts[i].needsVersion, conflicts[i].needsFlags, @@ -1347,7 +1347,7 @@ struct tsCallbackType { int pythonError; }; -static void * tsCallback(const Header h, const rpmCallbackType what, +static void * tsCallback(const Header h, const rpmCallbackType what, const unsigned long amount, const unsigned long total, const void * pkgKey, void * data) { struct tsCallbackType * cbInfo = data; @@ -1379,7 +1379,7 @@ static void * tsCallback(const Header h, const rpmCallbackType what, } if (what == RPMCALLBACK_INST_CLOSE_FILE) { - fdClose (fdt); + Fclose (fdt); } Py_DECREF(result); @@ -1395,16 +1395,16 @@ static PyObject * rpmtransRun(rpmtransObject * s, PyObject * args) { struct tsCallbackType cbInfo; if (!PyArg_ParseTuple(args, "iiOO", &flags, &ignoreSet, &cbInfo.cb, - &cbInfo.data)) + &cbInfo.data)) return NULL; cbInfo.pythonError = 0; - rc = rpmRunTransactions(s->ts, tsCallback, &cbInfo, NULL, &probs, flags, + rc = rpmRunTransactions(s->ts, tsCallback, &cbInfo, NULL, &probs, flags, ignoreSet); if (cbInfo.pythonError) { - if (rc > 0) + if (rc > 0) rpmProblemSetFree(probs); return NULL; } |