10 #define _RPMPS_INTERNAL
18 #define _RPMTS_INTERNAL
22 #define _RPMROLLBACK_INTERNAL
23 #include <rpmrollback.h>
37 #define rpmtsfree() rpmioFreePoolItem()
183 PyObject * r = PyObject_Repr(cb);
184 char *pyfn = (r !=
NULL ? PyString_AsString(r) :
"???");
186 if (PyErr_Occurred())
196 rpmts_SolveCallback(
rpmts ts,
rpmds ds,
const void * data)
204 fprintf(stderr,
"*** rpmts_SolveCallback(%p,%p,%p) \"%s\"\n", ts, ds, data,
rpmdsDNEVR(ds));
213 result = PyEval_CallObject(cbInfo->
cb, args);
222 if (PyInt_Check(result))
223 res = PyInt_AsLong(result);
227 cbInfo->
_save = PyEval_SaveThread();
246 PyObject * pkgObj = (PyObject *) pkgKey;
247 PyObject * oh =
NULL;
248 const char * origin =
NULL;
255 if (pkgObj ==
NULL) {
273 if (!(PyTuple_Check(pkgObj) && PyArg_ParseTuple(pkgObj,
"|Os", &oh, &origin)))
276 if (origin && origin[0] ==
'/' && origin[1] ==
'/')
283 result = PyEval_CallObject(cbInfo->
cb, args);
295 if (!PyArg_Parse(result,
"i", &fdno)) {
300 cbInfo->
_save = PyEval_SaveThread();
304 fprintf(stderr,
"\t%p = fdDup(%d)\n", fd, fdno);
306 fcntl(
Fileno(fd), F_SETFD, FD_CLOEXEC);
315 fprintf(stderr,
"\tFclose(%p)\n", fd);
319 fprintf(stderr,
"\t%llu:%llu key %p\n", (
unsigned long long)amount, (
unsigned long long)total, pkgKey);
323 cbInfo->
_save = PyEval_SaveThread();
328 #if Py_TPFLAGS_HAVE_ITER
336 fprintf(stderr,
"*** rpmts_iter(%p) ts %p\n", s, s->
ts);
339 return (PyObject *)
s;
351 PyObject * result =
NULL;
387 rpmts_Debug(
rpmtsObject * s, PyObject * args, PyObject * kwds)
393 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:Debug", kwlist,
398 fprintf(stderr,
"*** rpmts_Debug(%p) ts %p\n", s, s->
ts);
408 rpmts_AddInstall(
rpmtsObject * s, PyObject * args, PyObject * kwds)
416 char * kwlist[] = {
"header",
"key",
"how",
NULL};
418 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!O|s:AddInstall", kwlist,
422 { PyObject * hObj = (PyObject *) h;
424 PyErr_SetString(PyExc_TypeError,
"bad type for header argument");
430 fprintf(stderr,
"*** rpmts_AddInstall(%p,%p,%p,%s) ts %p\n", s, h, key, how, s->
ts);
433 PyErr_SetString(PyExc_TypeError,
"how argument must be \"u\", \"a\", or \"i\"");
435 }
else if (how && !
strcmp(how,
"u"))
453 rpmts_AddErase(
rpmtsObject * s, PyObject * args, PyObject * kwds)
460 char * kwlist[] = {
"name",
NULL};
463 fprintf(stderr,
"*** rpmts_AddErase(%p) ts %p\n", s, s->
ts);
465 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:AddErase", kwlist, &o))
468 if (PyString_Check(o) || PyUnicode_Check(o)) {
469 char *
name = PyString_AsString(o);
475 PyErr_SetString(
pyrpmError,
"package not installed");
487 if (PyInt_Check(o)) {
488 uint32_t instance = PyInt_AsLong(o);
491 if (instance == 0 || mi ==
NULL) {
493 PyErr_SetString(
pyrpmError,
"package not installed");
515 rpmts_Check(
rpmtsObject * s, PyObject * args, PyObject * kwds)
525 char * kwlist[] = {
"callback",
NULL};
527 memset(&cbInfo, 0,
sizeof(cbInfo));
528 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|O:Check", kwlist,
533 if (!PyCallable_Check(cbInfo.
cb)) {
534 PyErr_SetString(PyExc_TypeError,
"expected a callable");
541 fprintf(stderr,
"*** rpmts_Check(%p) ts %p cb %p\n", s, s->
ts, cbInfo.
cb);
545 cbInfo.
_save = PyEval_SaveThread();
556 list = PyList_New(0);
566 conflicts[i].byVersion, conflicts[i].byRelease,
568 conflicts[i].needsName,
569 conflicts[i].needsVersion,
571 conflicts[i].needsFlags,
572 conflicts[i].suggestedPkgs ?
573 conflicts[i].suggestedPkgs[0] :
Py_None,
576 char * byName, * byVersion, * byRelease, *byArch;
577 char * needsName, * needsOP, * needsVersion;
579 int needsFlags, sense;
589 if ((byArch= strrchr(byName,
'.')) !=
NULL)
591 if ((byRelease = strrchr(byName,
'-')) !=
NULL)
593 if ((byVersion = strrchr(byName,
'-')) !=
NULL)
599 if (needsName[1] ==
' ') {
600 sense = (needsName[0] ==
'C')
605 if ((needsVersion = strrchr(needsName,
' ')) !=
NULL)
606 *needsVersion++ =
'\0';
609 if ((needsOP = strrchr(needsName,
' ')) !=
NULL) {
610 for (*needsOP++ =
'\0'; *needsOP !=
'\0'; needsOP++) {
617 cf =
Py_BuildValue(
"((sss)(ss)iOi)", byName, byVersion, byRelease,
618 needsName, needsVersion, needsFlags,
619 (key !=
NULL ? key : Py_None),
649 fprintf(stderr,
"*** rpmts_Order(%p) ts %p\n", s, s->
ts);
651 Py_BEGIN_ALLOW_THREADS
667 fprintf(stderr,
"*** rpmts_Clean(%p) ts %p\n", s, s->
ts);
679 rpmts_IDTXload(
rpmtsObject * s, PyObject * args, PyObject * kwds)
683 PyObject * result =
NULL;
685 char * kwlist[] = {
"rbtid",
NULL};
690 fprintf(stderr,
"*** rpmts_IDTXload(%p) ts %p\n", s, s->
ts);
692 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|i:IDTXload", kwlist, &rbtid))
695 Py_BEGIN_ALLOW_THREADS
700 if (idtx ==
NULL || idtx->nidt <= 0) {
709 result = PyTuple_New(idtx->nidt);
710 for (i = 0; i < idtx->nidt; i++) {
713 tuple =
Py_BuildValue(
"(iOi)", idt->val.u32, ho, idt->instance);
714 PyTuple_SET_ITEM(result, i, tuple);
729 rpmts_IDTXglob(
rpmtsObject * s, PyObject * args, PyObject * kwds)
733 PyObject * result =
NULL;
736 char * kwlist[] = {
"rbtid",
NULL};
741 fprintf(stderr,
"*** rpmts_IDTXglob(%p) ts %p\n", s, s->
ts);
743 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|i:IDTXglob", kwlist, &rbtid))
746 Py_BEGIN_ALLOW_THREADS
749 globstr =
_free(globstr);
753 if (idtx ==
NULL || idtx->nidt <= 0) {
762 result = PyTuple_New(idtx->nidt);
763 for (i = 0; i < idtx->nidt; i++) {
767 PyTuple_SET_ITEM(result, i, tuple);
782 rpmts_Rollback(
rpmtsObject * s, PyObject * args, PyObject * kwds)
791 char * kwlist[] = {
"transactionId",
NULL};
794 fprintf(stderr,
"*** rpmts_Rollback(%p) ts %p\n", s, s->
ts);
796 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:Rollback", kwlist, &rbtid))
799 Py_BEGIN_ALLOW_THREADS
826 fprintf(stderr,
"*** rpmts_OpenDB(%p) ts %p\n", s, s->
ts);
844 fprintf(stderr,
"*** rpmts_CloseDB(%p) ts %p\n", s, s->
ts);
863 fprintf(stderr,
"*** rpmts_InitDB(%p) ts %p\n", s, s->
ts);
883 fprintf(stderr,
"*** rpmts_RebuildDB(%p) ts %p\n", s, s->
ts);
885 Py_BEGIN_ALLOW_THREADS
903 fprintf(stderr,
"*** rpmts_VerifyDB(%p) ts %p\n", s, s->
ts);
905 Py_BEGIN_ALLOW_THREADS
916 rpmts_HdrFromFdno(
rpmtsObject * s, PyObject * args, PyObject * kwds)
920 PyObject * result =
NULL;
925 char * kwlist[] = {
"fd",
NULL};
927 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:HdrFromFdno", kwlist,
936 fprintf(stderr,
"*** rpmts_HdrFromFdno(%p) ts %p rc %d\n", s, s->
ts, rpmrc);
948 PyErr_SetString(
pyrpmError,
"public key not available");
952 PyErr_SetString(
pyrpmError,
"public key not trusted");
958 PyErr_SetString(
pyrpmError,
"error reading package header");
970 rpmts_HdrCheck(
rpmtsObject * s, PyObject * args, PyObject * kwds)
975 PyObject * result =
NULL;
981 char * kwlist[] = {
"headers",
NULL};
984 fprintf(stderr,
"*** rpmts_HdrCheck(%p) ts %p\n", s, s->
ts);
986 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:HdrCheck", kwlist, &blob))
993 if (!(PyString_Check(blob) || PyUnicode_Check(blob))) {
994 PyErr_SetString(
pyrpmError,
"hdrCheck takes a string of octets");
997 uh = PyString_AsString(blob);
998 uc = PyString_Size(blob);
1012 PyErr_SetString(
pyrpmError,
"public key not availaiable");
1016 PyErr_SetString(
pyrpmError,
"public key not trusted");
1041 rpmts_SetVSFlags(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1045 char * kwlist[] = {
"flags",
NULL};
1048 fprintf(stderr,
"*** rpmts_SetVSFlags(%p) ts %p\n", s, s->
ts);
1050 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:SetVSFlags", kwlist,
1064 rpmts_SetColor(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1068 char * kwlist[] = {
"color",
NULL};
1071 fprintf(stderr,
"*** rpmts_SetColor(%p) ts %p\n", s, s->
ts);
1073 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:Color", kwlist, &tscolor))
1086 rpmts_PgpPrtPkts(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1091 unsigned char *
pkt;
1094 char * kwlist[] = {
"octets",
NULL};
1097 fprintf(stderr,
"*** rpmts_PgpPrtPkts(%p) ts %p\n", s, s->
ts);
1099 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:PgpPrtPkts", kwlist, &blob))
1106 if (!(PyString_Check(blob) || PyUnicode_Check(blob))) {
1107 PyErr_SetString(
pyrpmError,
"pgpPrtPkts takes a string of octets");
1110 pkt = (
unsigned char *) PyString_AsString(blob);
1111 pktlen = PyString_Size(blob);
1122 rpmts_PgpImportPubkey(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1127 unsigned char *
pkt;
1130 char * kwlist[] = {
"pubkey",
NULL};
1133 fprintf(stderr,
"*** rpmts_PgpImportPubkey(%p) ts %p\n", s, s->
ts);
1135 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:PgpImportPubkey",
1143 if (!(PyString_Check(blob) || PyUnicode_Check(blob))) {
1144 PyErr_SetString(
pyrpmError,
"PgpImportPubkey takes a string of octets");
1147 pkt = (
unsigned char *) PyString_AsString(blob);
1148 pktlen = PyString_Size(blob);
1158 rpmts_SetFlags(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1162 char * kwlist[] = {
"flags",
NULL};
1164 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:SetFlags", kwlist,
1169 fprintf(stderr,
"*** rpmts_SetFlags(%p) ts %p transFlags 0x%x\n", s, s->
ts, transFlags);
1180 rpmts_SetDFlags(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1184 char * kwlist[] = {
"flags",
NULL};
1186 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:SetDFlags", kwlist,
1191 fprintf(stderr,
"*** rpmts_SetDFlags(%p) ts %p depFlags 0x%x\n", s, s->
ts, depFlags);
1202 rpmts_SetProbFilter(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1207 char * kwlist[] = {
"ignoreSet",
NULL};
1209 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:ProbFilter", kwlist,
1214 fprintf(stderr,
"*** rpmts_SetProbFilter(%p) ts %p ignoreSet %x\n", s, s->
ts, ignoreSet);
1231 fprintf(stderr,
"*** rpmts_Problems(%p) ts %p\n", s, s->
ts);
1239 rpmts_Run(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1248 char * kwlist[] = {
"callback",
"data",
NULL};
1250 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"OO:Run", kwlist,
1251 &cbInfo.
cb, &cbInfo.
data))
1256 cbInfo.
_save = PyEval_SaveThread();
1259 if (!PyCallable_Check(cbInfo.
cb)) {
1260 PyErr_SetString(PyExc_TypeError,
"expected a callable");
1278 list = PyList_New(0);
1285 list = PyList_New(0);
1317 fprintf(stderr,
"*** rpmts_Next(%p) ts %p\n", s, s->
ts);
1319 result = rpmts_iternext(s);
1333 spec_Parse(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1337 const char * specfile;
1345 char * kwlist[] = {
"specfile",
NULL};
1347 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"s:Parse", kwlist, &specfile))
1351 cookie, anyarch, force, verify)!=0) {
1352 PyErr_SetString(
pyrpmError,
"can't parse specfile\n");
1364 rpmts_Match(
rpmtsObject * s, PyObject * args, PyObject * kwds)
1368 PyObject *TagN =
NULL;
1375 char * kwlist[] = {
"tagNumber",
"key",
NULL};
1378 fprintf(stderr,
"*** rpmts_Match(%p) ts %p\n", s, s->
ts);
1380 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|OO:Match", kwlist,
1385 PyErr_SetString(PyExc_TypeError,
"unknown tag type");
1391 if (PyString_Check(Key) || PyUnicode_Check(Key)) {
1392 key = PyString_AsString(Key);
1393 len = PyString_Size(Key);
1394 }
else if (PyInt_Check(Key)) {
1395 lkey = PyInt_AsLong(Key);
1396 key = (
char *)&lkey;
1399 PyErr_SetString(PyExc_TypeError,
"unknown key type");
1410 PyErr_SetString(PyExc_TypeError,
"rpmdb open failed");
1425 {
"Debug", (PyCFunction)rpmts_Debug, METH_VARARGS|METH_KEYWORDS,
1428 {
"addInstall", (PyCFunction) rpmts_AddInstall, METH_VARARGS|METH_KEYWORDS,
1430 {
"addErase", (PyCFunction) rpmts_AddErase, METH_VARARGS|METH_KEYWORDS,
1432 {
"setDFlags", (PyCFunction) rpmts_SetDFlags, METH_VARARGS|METH_KEYWORDS,
1433 "ts.setDFlags(depFlags) -> previous depFlags\n\
1434 - Set control bit(s) for executing ts.check() and ts.order().\n" },
1435 {
"check", (PyCFunction) rpmts_Check, METH_VARARGS|METH_KEYWORDS,
1437 {
"order", (PyCFunction) rpmts_Order, METH_NOARGS,
1439 {
"setFlags", (PyCFunction) rpmts_SetFlags, METH_VARARGS|METH_KEYWORDS,
1440 "ts.setFlags(transFlags) -> previous transFlags\n\
1441 - Set control bit(s) for executing ts.run().\n\
1442 Note: This method replaces the 1st argument to the old ts.run()\n" },
1443 {
"setProbFilter", (PyCFunction) rpmts_SetProbFilter, METH_VARARGS|METH_KEYWORDS,
1444 "ts.setProbFilter(ignoreSet) -> previous ignoreSet\n\
1445 - Set control bit(s) for ignoring problems found by ts.run().\n\
1446 Note: This method replaces the 2nd argument to the old ts.run()\n" },
1447 {
"problems", (PyCFunction) rpmts_Problems, METH_NOARGS,
1448 "ts.problems() -> ps\n\
1449 - Return current problem set.\n" },
1450 {
"run", (PyCFunction) rpmts_Run, METH_VARARGS|METH_KEYWORDS,
1451 "ts.run(callback, data) -> (problems)\n\
1452 - Run a transaction set, returning list of problems found.\n\
1453 Note: The callback may not be None.\n" },
1454 {
"clean", (PyCFunction) rpmts_Clean, METH_NOARGS,
1456 {
"IDTXload", (PyCFunction) rpmts_IDTXload, METH_VARARGS|METH_KEYWORDS,
1457 "ts.IDTXload(rbtid=iid) -> ((tid,hdr,instance)+)\n\
1458 - Return list of installed packages reverse sorted by transaction id.\n" },
1459 {
"IDTXglob", (PyCFunction) rpmts_IDTXglob, METH_VARARGS|METH_KEYWORDS,
1460 "ts.IDTXglob(rbtid=rid) -> ((tid,hdr,instance)+)\n\
1461 - Return list of removed packages reverse sorted by transaction id.\n" },
1462 {
"rollback", (PyCFunction) rpmts_Rollback, METH_VARARGS|METH_KEYWORDS,
1464 {
"openDB", (PyCFunction) rpmts_OpenDB, METH_NOARGS,
1465 "ts.openDB() -> None\n\
1466 - Open the default transaction rpmdb.\n\
1467 Note: The transaction rpmdb is lazily opened, so ts.openDB() is seldom needed.\n" },
1468 {
"closeDB", (PyCFunction) rpmts_CloseDB, METH_NOARGS,
1469 "ts.closeDB() -> None\n\
1470 - Close the default transaction rpmdb.\n\
1471 Note: ts.closeDB() disables lazy opens, and should hardly ever be used.\n" },
1472 {
"initDB", (PyCFunction) rpmts_InitDB, METH_NOARGS,
1473 "ts.initDB() -> None\n\
1474 - Initialize the default transaction rpmdb.\n\
1475 Note: ts.initDB() is seldom needed anymore.\n" },
1476 {
"rebuildDB", (PyCFunction) rpmts_RebuildDB, METH_NOARGS,
1477 "ts.rebuildDB() -> None\n\
1478 - Rebuild the default transaction rpmdb.\n" },
1479 {
"verifyDB", (PyCFunction) rpmts_VerifyDB, METH_NOARGS,
1480 "ts.verifyDB() -> None\n\
1481 - Verify the default transaction rpmdb.\n" },
1482 {
"hdrFromFdno",(PyCFunction) rpmts_HdrFromFdno,METH_VARARGS|METH_KEYWORDS,
1483 "ts.hdrFromFdno(fdno) -> hdr\n\
1484 - Read a package header from a file descriptor.\n" },
1485 {
"hdrCheck", (PyCFunction) rpmts_HdrCheck, METH_VARARGS|METH_KEYWORDS,
1488 "ts.getVSFlags() -> vsflags\n\
1489 - Retrieve current signature verification flags from transaction\n" },
1490 {
"setVSFlags",(PyCFunction) rpmts_SetVSFlags, METH_VARARGS|METH_KEYWORDS,
1491 "ts.setVSFlags(vsflags) -> ovsflags\n\
1492 - Set signature verification flags. Values for vsflags are:\n\
1493 rpm.RPMVSF_NOHDRCHK if set, don't check rpmdb headers\n\
1494 rpm.RPMVSF_NEEDPAYLOAD if not set, check header+payload (if possible)\n\
1495 rpm.RPMVSF_NOSHA1HEADER if set, don't check header SHA1 digest\n\
1496 rpm.RPMVSF_NODSAHEADER if set, don't check header DSA signature\n\
1497 rpm.RPMVSF_NORSAHEADER if set, don't check header RSA signature\n\
1498 rpm.RPMVSF_NOMD5 if set, don't check header+payload MD5 digest\n\
1499 rpm.RPMVSF_NODSA if set, don't check header+payload DSA signature\n\
1500 rpm.RPMVSF_NORSA if set, don't check header+payload RSA signature\n\
1502 {
"setColor",(PyCFunction) rpmts_SetColor, METH_VARARGS|METH_KEYWORDS,
1504 {
"pgpPrtPkts", (PyCFunction) rpmts_PgpPrtPkts, METH_VARARGS|METH_KEYWORDS,
1506 {
"pgpImportPubkey", (PyCFunction) rpmts_PgpImportPubkey, METH_VARARGS|METH_KEYWORDS,
1508 {
"parseSpec", (PyCFunction) spec_Parse, METH_VARARGS|METH_KEYWORDS,
1509 "ts.parseSpec(\"/path/to/foo.spec\") -> spec\n\
1510 - Parse a spec file.\n" },
1511 {
"dbMatch", (PyCFunction) rpmts_Match, METH_VARARGS|METH_KEYWORDS,
1512 "ts.dbMatch([TagN, [key, [len]]]) -> mi\n\
1513 - Create a match iterator for the default transaction rpmdb.\n" },
1514 {
"next", (PyCFunction)rpmts_Next, METH_NOARGS,
1516 - Retrieve next transaction set element.\n" },
1542 return PyObject_GenericGetAttr(o, n);
1551 char *
name = PyString_AsString(n);
1554 if (!
strcmp(name,
"scriptFd")) {
1555 if (!PyArg_Parse(v,
"i", &fdno))
return 0;
1557 PyErr_SetString(PyExc_TypeError,
"bad file descriptor");
1564 PyErr_SetString(PyExc_AttributeError, name);
1606 PyObject * s = PyType_GenericAlloc(subtype, nitems);
1609 fprintf(stderr,
"*** rpmts_alloc(%p,%d) ret %p\n", subtype, nitems, s);
1615 static PyObject *
rpmts_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
1621 char * rootDir =
"/";
1623 char * kwlist[] = {
"rootdir",
"vsflags", 0};
1626 fprintf(stderr,
"*** rpmts_init(%p,%p,%p)\n", s, args, kwds);
1628 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|si:rpmts_init", kwlist,
1629 &rootDir, &vsflags))
1647 return (PyObject *)
s;
1660 PyObject_HEAD_INIT(&PyType_Type)
1682 #if Py_TPFLAGS_HAVE_ITER
1687 (getiterfunc) rpmts_iter,
1688 (iternextfunc) rpmts_iternext,
1712 return PyObject_Call((PyObject *) &rpmts_Type, args, kwds);
rpmRelocation relocations
int rpmtsSetNotifyCallback(rpmts ts, rpmCallbackFunction notify, rpmCallbackData notifyData)
Set transaction notify callback function and argument.
int rpmtsSolve(rpmts ts, rpmds ds, const void *data)
Attempt to solve a needed dependency using the solve database.
rpmdsObject * rpmds_Wrap(rpmds ds)
static int rpmtsInitDB(rpmts ts, int dbmode)
Initialize the database used by the transaction.
static int rpmtsVerifyDB(rpmts ts)
Verify the database used by the transaction.
specObject * spec_Wrap(Spec spec)
static int rpmts_setattro(PyObject *o, PyObject *n, PyObject *v)
rpmlog(RPMLOG_ERR,"%s\n", buf)
struct rpmte_s * rpmte
An element of a transaction set, i.e.
const char * rpmProblemString(const rpmProblem prob)
Return formatted string representation of a problem.
rpmpsObject * rpmps_Wrap(rpmps ps)
int(* rpmtsRun)(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
Process all package elements in a transaction set.
OpenPGP constants and structures from RFC-2440.
static PyObject * rpmts_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
static struct PyMethodDef rpmts_methods[]
char * xstrdup(const char *str)
int rpmtsDBMode(rpmts ts)
Retrieve dbmode of transaction set.
uint32_t rpmmiInstance(rpmmi mi)
Return header instance for current position of rpmdb iterator.
static void fdSetOpen(FD_t fd, const char *path, int flags, mode_t mode)
enum rpmprobFilterFlags_e rpmprobFilterFlags
rpmpsi rpmpsFreeIterator(rpmpsi psi)
Destroy problem set iterator.
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
Set transaction flags, i.e.
struct rpmts_s * rpmts
The RPM Transaction Set.
rpmteObject * rpmte_Wrap(rpmte te)
IDTX IDTXglob(rpmts ts, const char *globstr, rpmTag tag, rpmuint32_t rbtid)
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
static PyObject *const char * globstr
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
int rpmtsSetSolveCallback(rpmts ts, int(*solve)(rpmts ts, rpmds key, const void *data), const void *solveData)
static PyObject * rpmts_GetVSFlags(rpmtsObject *s)
char * rpmProblemGetPkgNEVR(rpmProblem prob)
Return the package NEVR causing the problem.
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
static PyObject * rpmts_alloc(PyTypeObject *subtype, int nitems)
rpmRC headerCheck(pgpDig dig, const void *uh, size_t uc, const char **msg)
Check header consistency, performing headerGet() the hard way.
rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
Return next transaction element of type.
int rpmtsRebuildDB(rpmts ts)
Rebuild the database used by the transaction.
struct rpmps_s * rpmps
Transaction problems found while processing a transaction set/.
rpmRC rpmcliImportPubkey(const rpmts ts, const unsigned char *pkt, ssize_t pktlen)
Import public key packet(s).
static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject *static PyObject * Key
Command line option information.
static hdrObject *hdrObject * ho
PyObject * rpmts_Create(PyObject *s, PyObject *args, PyObject *kwds)
rpmdepFlags rpmtsSetDFlags(rpmts ts, rpmdepFlags depFlags)
Set dependency flags, i.e.
PyList_Append(s->keyList, key)
int parseSpec(rpmts ts, const char *specFile, const char *rootURL, int recursing, const char *passPhrase, const char *cookie, int anyarch, int force, int verify)
Parse spec file into spec control structure.
pgpDig pgpDigNew(pgpVSFlags vsflags, pgpPubkeyAlgo pubkey_algo)
Create a container for parsed OpenPGP packates.
enum rpmRC_e rpmRC
RPM return codes.
memset(_r, 0, sizeof(*_r))
char * rpmProblemGetStr(rpmProblem prob)
Return a generic data string from a problem.
rpmts rpmtsCreate(void)
Create an empty transaction set.
struct rpmtsCallbackType_s cbInfo
void rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
static PyObject *rpmprobFilterFlags oignoreSet
int rpmtsAddEraseElement(rpmts ts, Header h, uint32_t hdrNum)
Add package to be erased to transaction set.
static void rpmts_Die(PyObject *cb)
rpmmi rpmmiFree(rpmmi mi)
Destroy rpm database iterator.
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
unsigned int rpmmiCount(rpmmi mi)
Return number of elements in rpm database iterator.
int rpmpsNextIterator(rpmpsi psi)
Return next problem set iterator index.
char * rpmProblemGetAltNEVR(rpmProblem prob)
Return the second package NEVR causing the problem.
rpmTag tagNumFromPyObject(PyObject *item)
unsigned long long rpmuint64_t
int rpmtsCloseDB(rpmts ts)
Close the database used by the transaction.
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char *fn, Header *hdrp)
Return package header from file handle, verifying digests/signatures.
Header rpmmiNext(rpmmi mi)
Return next package header from iteration.
int pgpPrtPkts(const rpmuint8_t *pkts, size_t pktlen, pgpDig dig, int printing)
Print/parse a OpenPGP packet(s).
int rpmtsAddInstallElement(rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation relocs)
Add package to be installed to transaction set.
The FD_t File Handle data structure.
pgpDig pgpDigFree(pgpDig dig)
Destroy a container for parsed OpenPGP packates.
hdrObject * hdr_Wrap(Header h)
int rpmRollback(rpmts ts, QVA_t ia, const char **argv)
rpmprobFilterFlags ignoreSet
rpmpsi rpmpsInitIterator(rpmps ps)
Initialize problem set iterator.
The structure used to store values parsed from a spec file.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
rpmtsi rpmtsiFree(rpmtsi tsi)
Destroy transaction element iterator.
static void rpmts_dealloc(rpmtsObject *s)
int rpmtsSetDBMode(rpmts ts, int dbmode)
Set dbmode of transaction set.
pgpVSFlags rpmVSFlags
Bit(s) to control digest and signature verification.
rpmInstallInterfaceFlags installInterfaceFlags
PyEval_RestoreThread(cbInfo->_save)
int Fclose(FD_t fd)
fclose(3) clone.
rpmuint64_t rpmProblemGetDiskNeed(rpmProblem prob)
Return generic pointer/long attribute from a problem.
static int rpmts_init(rpmtsObject *s, PyObject *args, PyObject *kwds)
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
rpmprobFilterFlags probFilter
rpmps rpmpsFree(rpmps ps)
Destroy a problem set.
IDTX IDTXload(rpmts ts, rpmTag tag, rpmuint32_t rbtid)
Spec rpmtsSpec(rpmts ts)
Get spec control structure from transaction set.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
void rpmtsClean(rpmts ts)
Free memory needed only for dependency checks and ordering.
return Py_BuildValue("i", pkgKey)
return strcmp(ame->name, bme->name)
rpmuint32_t rpmtsSetColor(rpmts ts, rpmuint32_t color)
Set color bits of transaction set.
This is the only module users of librpmbuild should need to include.
static PyObject *rpmtransFlags transFlags
enum rpmtransFlags_e rpmtransFlags
Bit(s) to control rpmtsRun() operation.
rpmProblem rpmpsProblem(rpmpsi psi)
Return current problem from problem set.
Methods to handle package elements.
Header hdrGetHeader(hdrObject *s)
int(* rpmtsOrder)(rpmts ts)
Determine package order in a transaction set according to dependencies.
const char * rpmdsDNEVR(const rpmds ds)
Return current formatted dependency string.
rpmVSFlags rpmtsVSFlags(rpmts ts)
Get verify signatures flag(s).
struct rpmProblem_s * rpmProblem
Raw data for an element of a problem set.
static void rpmts_free(rpmtsObject *s)
rpmProblemType rpmProblemGetType(rpmProblem prob)
Return the problem type.
return rpmmi_Wrap(rpmmiInit(s->db, tag, key, len))
int Fileno(FD_t fd)
fileno(3) clone.
int rpmdbCheckTerminate(int terminate)
Check rpmdb signal handler for trapped signal and/or requested exit.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
static PyObject *unsigned char * pkt
fnpyKey rpmProblemKey(rpmProblem prob)
Return the transaction key causing the problem.
Access RPM indices using Berkeley DB interface(s).
rpmmi rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
int(* rpmtsCheck)(rpmts ts)
Perform dependency resolution on the transaction set.
enum rpmdepFlags_e rpmdepFlags
Bit(s) to control rpmtsCheck() and rpmtsOrder() operation.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
static PyObject * rpmts_getattro(PyObject *o, PyObject *n)
static void * rpmtsCallback(const void *hd, const rpmCallbackType what, const rpmuint64_t amount, const rpmuint64_t total, fnpyKey pkgKey, rpmCallbackData data)
void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
#define RPMDBI_PACKAGES
Pseudo-tags used by the rpmdb and rpmgi iterator API's.
rpmtsi rpmtsiInit(rpmts ts)
Create transaction element iterator.
struct rpmtsObject_s rpmtsObject
static PyObject *rpmds ds
rpmps rpmtsProblems(rpmts ts)
Return current transaction set problems.