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())
200 PyObject * args, * result;
204 fprintf(stderr,
"*** rpmts_SolveCallback(%p,%p,%p) \"%s\"\n", ts, ds, data,
rpmdsDNEVR(ds));
206 if (cbInfo->
tso == NULL)
return res;
207 if (cbInfo->
cb == Py_None)
return res;
209 PyEval_RestoreThread(cbInfo->
_save);
212 args = Py_BuildValue(
"(OO)", cbInfo->
tso, cbInfo->
dso);
213 result = PyEval_CallObject(cbInfo->
cb, args);
214 Py_XDECREF(cbInfo->
dso);
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;
249 PyObject * args, * result;
252 if (cbInfo->
cb == Py_None)
return NULL;
255 if (pkgObj == NULL) {
257 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
260 pkgObj = Py_BuildValue(
"s", he->
p.
str);
273 if (!(PyTuple_Check(pkgObj) && PyArg_ParseTuple(pkgObj,
"|Os", &oh, &origin)))
276 if (origin && origin[0] ==
'/' && origin[1] ==
'/')
280 PyEval_RestoreThread(cbInfo->
_save);
282 args = Py_BuildValue(
"(iLLOO)", what, amount, total, pkgObj, cbInfo->
data);
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;
355 fprintf(stderr,
"*** rpmts_iternext(%p) ts %p tsi %p %d\n", s, s->
ts, s->
tsi, s->
tsiFilter);
358 if (s->
tsi == NULL) {
391 char * kwlist[] = {
"debugLevel", NULL};
393 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:Debug", kwlist,
398 fprintf(stderr,
"*** rpmts_Debug(%p) ts %p\n", s, s->
ts);
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);
432 if (how && strcmp(how,
"a") && strcmp(how,
"u") && strcmp(how,
"i")) {
433 PyErr_SetString(PyExc_TypeError,
"how argument must be \"u\", \"a\", or \"i\"");
435 }
else if (how && !strcmp(how,
"u"))
442 PyList_Append(s->
keyList, key);
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");
521 PyObject * list, * cf;
525 char * kwlist[] = {
"callback", NULL};
527 memset(&cbInfo, 0,
sizeof(cbInfo));
528 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|O:Check", kwlist,
532 if (cbInfo.
cb != NULL) {
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();
553 PyEval_RestoreThread(cbInfo.
_save);
556 list = PyList_New(0);
565 cf = Py_BuildValue(
"((sss)(ss)iOi)", conflicts[i].byName,
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),
624 PyList_Append(list, (PyObject *) cf);
649 fprintf(stderr,
"*** rpmts_Order(%p) ts %p\n", s, s->
ts);
651 Py_BEGIN_ALLOW_THREADS
655 return Py_BuildValue(
"i", rc);
667 fprintf(stderr,
"*** rpmts_Clean(%p) ts %p\n", s, s->
ts);
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);
733 PyObject * result = NULL;
734 const char * globstr;
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
747 globstr =
rpmExpand(
"%{_repackage_dir}/*.rpm", NULL);
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++) {
766 tuple = Py_BuildValue(
"(iOs)", idt->val.u32, ho, idt->key);
767 PyTuple_SET_ITEM(result, i, tuple);
786 QVA_t ia = memset(
alloca(
sizeof(*ia)), 0,
sizeof(*ia));
788 const char ** av = NULL;
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
813 return Py_BuildValue(
"i", rc);
826 fprintf(stderr,
"*** rpmts_OpenDB(%p) ts %p\n", s, s->
ts);
844 fprintf(stderr,
"*** rpmts_CloseDB(%p) ts %p\n", s, s->
ts);
849 return Py_BuildValue(
"i", rc);
863 fprintf(stderr,
"*** rpmts_InitDB(%p) ts %p\n", s, s->
ts);
869 return Py_BuildValue(
"i", rc);
883 fprintf(stderr,
"*** rpmts_RebuildDB(%p) ts %p\n", s, s->
ts);
885 Py_BEGIN_ALLOW_THREADS
889 return Py_BuildValue(
"i", rc);
903 fprintf(stderr,
"*** rpmts_VerifyDB(%p) ts %p\n", s, s->
ts);
905 Py_BEGIN_ALLOW_THREADS
909 return Py_BuildValue(
"i", rc);
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);
942 result = Py_BuildValue(
"N",
hdr_Wrap(h));
948 PyErr_SetString(
pyrpmError,
"public key not available");
952 PyErr_SetString(
pyrpmError,
"public key not trusted");
958 PyErr_SetString(
pyrpmError,
"error reading package header");
975 PyObject * result = NULL;
976 const char * msg = 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))
989 if (blob == Py_None) {
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");
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,
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))
1091 unsigned char * pkt;
1092 unsigned int pktlen;
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))
1102 if (blob == Py_None) {
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);
1115 return Py_BuildValue(
"i", rc);
1127 unsigned char * pkt;
1128 unsigned int pktlen;
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",
1139 if (blob == Py_None) {
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);
1152 return Py_BuildValue(
"i", rc);
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);
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);
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);
1219 return Py_BuildValue(
"i", oignoreSet);
1231 fprintf(stderr,
"*** rpmts_Problems(%p) ts %p\n", s, s->
ts);
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();
1258 if (cbInfo.
cb != NULL) {
1259 if (!PyCallable_Check(cbInfo.
cb)) {
1260 PyErr_SetString(PyExc_TypeError,
"expected a callable");
1267 fprintf(stderr,
"*** rpmts_Run(%p) ts %p ignore %x\n", s, s->
ts, s->
ignoreSet);
1275 PyEval_RestoreThread(cbInfo.
_save);
1278 list = PyList_New(0);
1285 list = PyList_New(0);
1296 PyList_Append(list, prob);
1317 fprintf(stderr,
"*** rpmts_Next(%p) ts %p\n", s, s->
ts);
1321 if (result == NULL) {
1337 const char * specfile;
1340 char * passPhrase =
"";
1341 char *cookie = NULL;
1345 char * kwlist[] = {
"specfile", NULL};
1347 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"s:Parse", kwlist, &specfile))
1350 if (
parseSpec(s->
ts, specfile,
"/", recursing, passPhrase,
1351 cookie, anyarch, force, verify)!=0) {
1352 PyErr_SetString(
pyrpmError,
"can't parse specfile\n");
1368 PyObject *TagN = NULL;
1369 PyObject *Key = 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,
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,
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" },
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" },
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" },
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,
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" },
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" },
1473 "ts.initDB() -> None\n\ 1474 - Initialize the default transaction rpmdb.\n\ 1475 Note: ts.initDB() is seldom needed anymore.\n" },
1477 "ts.rebuildDB() -> None\n\ 1478 - Rebuild the default transaction rpmdb.\n" },
1480 "ts.verifyDB() -> None\n\ 1481 - Verify the default transaction rpmdb.\n" },
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" },
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,
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" },
1536 PyObject_Del((PyObject *)s);
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);
1598 PyObject_Del((PyObject *)s);
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 1712 return PyObject_Call((PyObject *) &
rpmts_Type, args, kwds);
static specObject * spec_Parse(rpmtsObject *s, PyObject *args, PyObject *kwds)
rpmRelocation relocations
Spec rpmtsSpec(rpmts ts)
Get spec control structure from transaction set.
static int rpmts_setattro(PyObject *o, PyObject *n, PyObject *v)
specObject * spec_Wrap(Spec spec)
static PyObject * rpmts_SetVSFlags(rpmtsObject *s, PyObject *args, PyObject *kwds)
static PyObject * rpmts_iter(rpmtsObject *s)
pgpDig pgpDigFree(pgpDig dig)
Destroy a container for parsed OpenPGP packates.
const char * rpmProblemString(const rpmProblem prob)
Return formatted string representation of a problem.
rpmRC rpmcliImportPubkey(const rpmts ts, const unsigned char *pkt, ssize_t pktlen)
Import public key packet(s).
OpenPGP constants and structures from RFC-2440.
uint32_t rpmmiInstance(rpmmi mi)
Return header instance for current position of rpmdb iterator.
char * xstrdup(const char *str)
int rpmtsAddInstallElement(rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation relocs)
Add package to be installed to transaction set.
static PyObject * rpmts_Check(rpmtsObject *s, PyObject *args, PyObject *kwds)
enum rpmprobFilterFlags_e rpmprobFilterFlags
struct headerToken_s * Header
rpmpsi rpmpsFreeIterator(rpmpsi psi)
Destroy problem set iterator.
IDTX IDTXglob(rpmts ts, const char *globstr, rpmTag tag, rpmuint32_t rbtid)
rpmpsObject * rpmps_Wrap(rpmps ps)
int rpmtsSetSolveCallback(rpmts ts, int(*solve)(rpmts ts, rpmds key, const void *data), const void *solveData)
static PyObject * rpmts_GetVSFlags(rpmtsObject *s)
static int rpmtsVerifyDB(rpmts ts)
Verify the database used by the transaction.
static PyObject * rpmts_InitDB(rpmtsObject *s)
char * rpmProblemGetPkgNEVR(rpmProblem prob)
Return the package NEVR causing the problem.
int(* rpmtsOrder)(rpmts ts)
Determine package order in a transaction set according to dependencies.
static rpmmiObject * rpmts_Match(rpmtsObject *s, PyObject *args, PyObject *kwds)
static rpmVSFlags vsflags
int rpmtsSetNotifyCallback(rpmts ts, rpmCallbackFunction notify, rpmCallbackData notifyData)
Set transaction notify callback function and argument.
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
rpmRC headerCheck(pgpDig dig, const void *uh, size_t uc, const char **msg)
Check header consistency, performing headerGet() the hard way.
static PyObject * rpmts_PgpImportPubkey(rpmtsObject *s, PyObject *args, PyObject *kwds)
static PyObject * rpmts_SetColor(rpmtsObject *s, PyObject *args, PyObject *kwds)
static PyObject * rpmts_IDTXload(rpmtsObject *s, PyObject *args, PyObject *kwds)
static PyObject * rpmts_HdrCheck(rpmtsObject *s, PyObject *args, PyObject *kwds)
static PyObject * rpmts_alloc(PyTypeObject *subtype, int nitems)
rpmtsi rpmtsiFree(rpmtsi tsi)
Destroy transaction element iterator.
static void rpmlog(int code, const char *fmt,...)
struct rpmps_s * rpmps
Transaction problems found while processing a transaction set/.
const char * rpmdsDNEVR(const rpmds ds)
Return current formatted dependency string.
static PyObject * rpmts_Clean(rpmtsObject *s)
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
static PyObject * rpmts_Rollback(rpmtsObject *s, PyObject *args, PyObject *kwds)
static PyObject * rpmts_VerifyDB(rpmtsObject *s)
static PyObject * rpmts_CloseDB(rpmtsObject *s)
rpmmiObject * rpmmi_Wrap(rpmmi mi)
Command line option information.
static rpmpsObject * rpmts_Problems(rpmtsObject *s)
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.
struct rpmte_s * rpmte
An element of a transaction set, i.e.
int rpmdbCheckTerminate(int terminate)
Check rpmdb signal handler for trapped signal and/or requested exit.
static PyObject * rpmts_OpenDB(rpmtsObject *s)
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
Set transaction flags, i.e.
static int rpmts_SolveCallback(rpmts ts, rpmds ds, const void *data)
char * rpmProblemGetStr(rpmProblem prob)
Return a generic data string from a problem.
static void rpmts_Die(PyObject *cb)
PyObject * rpmts_Create(PyObject *s, PyObject *args, PyObject *kwds)
int rpmpsNextIterator(rpmpsi psi)
Return next problem set iterator index.
char * rpmProblemGetAltNEVR(rpmProblem prob)
Return the second package NEVR causing the problem.
static int rpmtsInitDB(rpmts ts, int dbmode)
Initialize the database used by the transaction.
enum rpmdepFlags_e rpmdepFlags
Bit(s) to control rpmtsCheck() and rpmtsOrder() operation.
unsigned long long rpmuint64_t
int(* rpmtsCheck)(rpmts ts)
Perform dependency resolution on the transaction set.
static PyObject * rpmts_Debug(rpmtsObject *s, PyObject *args, PyObject *kwds)
static void fdSetOpen(FD_t fd, const char *path, int flags, mode_t mode)
static void rpmts_dealloc(rpmtsObject *s)
static int rpmts_init(rpmtsObject *s, PyObject *args, PyObject *kwds)
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char *fn, Header *hdrp)
Return package header from file handle, verifying digests/signatures.
static PyObject * rpmts_AddErase(rpmtsObject *s, PyObject *args, PyObject *kwds)
int rpmtsRebuildDB(rpmts ts)
Rebuild the database used by the transaction.
The FD_t File Handle data structure.
static PyObject * rpmts_SetDFlags(rpmtsObject *s, PyObject *args, PyObject *kwds)
rpmmi rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
int rpmRollback(rpmts ts, QVA_t ia, const char **argv)
rpmprobFilterFlags ignoreSet
int rpmtsSolve(rpmts ts, rpmds ds, const void *data)
Attempt to solve a needed dependency using the solve database.
rpmpsi rpmpsInitIterator(rpmps ps)
Initialize problem set iterator.
rpmdsObject * rpmds_Wrap(rpmds ds)
The structure used to store values parsed from a spec file.
pgpVSFlags rpmVSFlags
Bit(s) to control digest and signature verification.
Header headerFree(Header h)
Dereference a header instance.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
static PyObject * rpmts_iternext(rpmtsObject *s)
int(* rpmtsRun)(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
Process all package elements in a transaction set.
void rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
int rpmtsSetDBMode(rpmts ts, int dbmode)
Set dbmode of transaction set.
rpmInstallInterfaceFlags installInterfaceFlags
rpmmi rpmmiFree(rpmmi mi)
Destroy rpm database iterator.
int Fclose(FD_t fd)
fclose(3) clone.
rpmuint64_t rpmProblemGetDiskNeed(rpmProblem prob)
Return generic pointer/long attribute from a problem.
static PyObject * rpmts_AddInstall(rpmtsObject *s, PyObject *args, PyObject *kwds)
rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
Return next transaction element of type.
rpmprobFilterFlags probFilter
static PyObject * rpmts_Next(rpmtsObject *s)
rpmps rpmpsFree(rpmps ps)
Destroy a problem set.
rpmteObject * rpmte_Wrap(rpmte te)
IDTX IDTXload(rpmts ts, rpmTag tag, rpmuint32_t rbtid)
static PyObject * rpmts_HdrFromFdno(rpmtsObject *s, PyObject *args, PyObject *kwds)
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
static PyObject * rpmts_IDTXglob(rpmtsObject *s, PyObject *args, PyObject *kwds)
enum rpmRC_e rpmRC
RPM return codes.
pgpDig pgpDigNew(pgpVSFlags vsflags, pgpPubkeyAlgo pubkey_algo)
Create a container for parsed OpenPGP packates.
static PyObject * rpmts_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
static PyObject * rpmts_Run(rpmtsObject *s, PyObject *args, PyObject *kwds)
This is the only module users of librpmbuild should need to include.
rpmdepFlags rpmtsSetDFlags(rpmts ts, rpmdepFlags depFlags)
Set dependency flags, i.e.
rpmts rpmtsFree(rpmts ts)
Destroy transaction set, closing the database as well.
struct rpmtsObject_s rpmtsObject
rpmts rpmtsCreate(void)
Create an empty transaction set.
rpmProblem rpmpsProblem(rpmpsi psi)
Return current problem from problem set.
Methods to handle package elements.
rpmps rpmtsProblems(rpmts ts)
Return current transaction set problems.
enum rpmtransFlags_e rpmtransFlags
Bit(s) to control rpmtsRun() operation.
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
struct rpmts_s * rpmts
The RPM Transaction Set.
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
static PyObject * rpmts_RebuildDB(rpmtsObject *s)
Header rpmmiNext(rpmmi mi)
Return next package header from iteration.
static PyObject * rpmts_SetProbFilter(rpmtsObject *s, PyObject *args, PyObject *kwds)
rpmVSFlags rpmtsVSFlags(rpmts ts)
Get verify signatures flag(s).
static PyObject * rpmts_PgpPrtPkts(rpmtsObject *s, PyObject *args, PyObject *kwds)
struct rpmProblem_s * rpmProblem
Raw data for an element of a problem set.
int rpmtsAddEraseElement(rpmts ts, Header h, uint32_t hdrNum)
Add package to be erased to transaction set.
rpmProblemType rpmProblemGetType(rpmProblem prob)
Return the problem type.
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
int pgpPrtPkts(const rpmuint8_t *pkts, size_t pktlen, pgpDig dig, int printing)
Print/parse a OpenPGP packet(s).
int Fileno(FD_t fd)
fileno(3) clone.
fnpyKey rpmProblemKey(rpmProblem prob)
Return the transaction key causing the problem.
rpmtsi rpmtsiInit(rpmts ts)
Create transaction element iterator.
Access RPM indices using Berkeley DB interface(s).
static struct PyMethodDef rpmts_methods[]
static PyObject * rpmts_SetFlags(rpmtsObject *s, PyObject *args, PyObject *kwds)
static PyObject * rpmts_Order(rpmtsObject *s)
unsigned int rpmmiCount(rpmmi mi)
Return number of elements in rpm database iterator.
int rpmtsDBMode(rpmts ts)
Retrieve dbmode of transaction set.
rpmuint32_t rpmtsSetColor(rpmts ts, rpmuint32_t color)
Set color bits of transaction set.
int rpmtsCloseDB(rpmts ts)
Close the database used by the transaction.
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)
static void rpmts_free(rpmtsObject *s)
void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
#define RPMDBI_PACKAGES
Pseudo-tags used by the rpmdb and rpmgi iterator API's.
void rpmtsClean(rpmts ts)
Free memory needed only for dependency checks and ordering.