10 #define _RPMPS_INTERNAL
18 #define _RPMTS_INTERNAL
22 #define _RPMROLLBACK_INTERNAL
37 #define rpmtsfree() rpmioFreePoolItem()
186 PyObject * r = PyObject_Repr(cb);
187 char *pyfn = (r != NULL ? PyString_AsString(r) :
"???");
189 if (PyErr_Occurred())
203 PyObject * args, * result;
207 fprintf(stderr,
"*** rpmts_SolveCallback(%p,%p,%p) \"%s\"\n", ts, ds, data,
rpmdsDNEVR(ds));
209 if (cbInfo->
tso == NULL)
return res;
210 if (cbInfo->
cb == Py_None)
return res;
212 PyEval_RestoreThread(cbInfo->
_save);
215 args = Py_BuildValue(
"(OO)", cbInfo->
tso, cbInfo->
dso);
216 result = PyEval_CallObject(cbInfo->
cb, args);
217 Py_XDECREF(cbInfo->
dso);
225 if (PyInt_Check(result))
226 res = PyInt_AsLong(result);
230 cbInfo->
_save = PyEval_SaveThread();
249 PyObject * pkgObj = (PyObject *) pkgKey;
250 PyObject * oh = NULL;
251 const char * origin = NULL;
252 PyObject * args, * result;
255 if (cbInfo->
cb == Py_None)
return NULL;
258 if (pkgObj == NULL) {
260 HE_t he = memset(
alloca(
sizeof(*he)), 0,
sizeof(*he));
263 pkgObj = Py_BuildValue(
"s", he->
p.
str);
276 if (!(PyTuple_Check(pkgObj) && PyArg_ParseTuple(pkgObj,
"|Os", &oh, &origin)))
279 if (origin && origin[0] ==
'/' && origin[1] ==
'/')
283 PyEval_RestoreThread(cbInfo->
_save);
285 args = Py_BuildValue(
"(iLLOO)", what, amount, total, pkgObj, cbInfo->
data);
286 result = PyEval_CallObject(cbInfo->
cb, args);
298 if (!PyArg_Parse(result,
"i", &fdno)) {
303 cbInfo->
_save = PyEval_SaveThread();
307 fprintf(stderr,
"\t%p = fdDup(%d)\n", fd, fdno);
309 fcntl(
Fileno(fd), F_SETFD, FD_CLOEXEC);
318 fprintf(stderr,
"\tFclose(%p)\n", fd);
322 fprintf(stderr,
"\t%llu:%llu key %p\n", (
unsigned long long)amount, (
unsigned long long)total, pkgKey);
326 cbInfo->
_save = PyEval_SaveThread();
331 #if Py_TPFLAGS_HAVE_ITER
339 fprintf(stderr,
"*** rpmts_iter(%p) ts %p\n", s, s->
ts);
342 return (PyObject *)s;
354 PyObject * result = NULL;
358 fprintf(stderr,
"*** rpmts_iternext(%p) ts %p tsi %p %d\n", s, s->
ts, s->
tsi, s->
tsiFilter);
361 if (s->
tsi == NULL) {
394 char * kwlist[] = {
"debugLevel", NULL};
396 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:Debug", kwlist,
401 fprintf(stderr,
"*** rpmts_Debug(%p) ts %p\n", s, s->
ts);
418 char * kwlist[] = {
"header",
"key",
"how", NULL};
420 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!O|s:AddInstall", kwlist,
424 { PyObject * hObj = (PyObject *) h;
426 PyErr_SetString(PyExc_TypeError,
"bad type for header argument");
432 fprintf(stderr,
"*** rpmts_AddInstall(%p,%p,%p,%s) ts %p\n", s, h, key, how, s->
ts);
434 if (how && strcmp(how,
"a") && strcmp(how,
"u") && strcmp(how,
"i")) {
435 PyErr_SetString(PyExc_TypeError,
"how argument must be \"u\", \"a\", or \"i\"");
437 }
else if (how && !strcmp(how,
"u"))
444 PyList_Append(s->
keyList, key);
461 char * kwlist[] = {
"name", NULL};
464 fprintf(stderr,
"*** rpmts_AddErase(%p) ts %p\n", s, s->
ts);
466 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:AddErase", kwlist, &o))
469 if (PyString_Check(o) || PyUnicode_Check(o)) {
470 char *
name = PyString_AsString(o);
476 PyErr_SetString(
pyrpmError,
"package not installed");
488 if (PyInt_Check(o)) {
489 uint32_t instance = PyInt_AsLong(o);
492 if (instance == 0 || mi == NULL) {
494 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);
648 fprintf(stderr,
"*** rpmts_Order(%p) ts %p\n", s, s->
ts);
650 Py_BEGIN_ALLOW_THREADS
654 return Py_BuildValue(
"i", rc);
666 fprintf(stderr,
"*** rpmts_Clean(%p) ts %p\n", s, s->
ts);
681 PyObject * result = NULL;
683 char * kwlist[] = {
"rbtid", NULL};
688 fprintf(stderr,
"*** rpmts_IDTXload(%p) ts %p\n", s, s->
ts);
690 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|i:IDTXload", kwlist, &rbtid))
693 Py_BEGIN_ALLOW_THREADS
698 if (idtx == NULL || idtx->nidt <= 0) {
707 result = PyTuple_New(idtx->nidt);
708 for (i = 0; i < idtx->nidt; i++) {
711 tuple = Py_BuildValue(
"(iOi)", idt->val.u32, ho, idt->instance);
712 PyTuple_SET_ITEM(result, i, tuple);
731 PyObject * result = NULL;
732 const char * globstr;
734 char * kwlist[] = {
"rbtid", NULL};
739 fprintf(stderr,
"*** rpmts_IDTXglob(%p) ts %p\n", s, s->
ts);
741 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|i:IDTXglob", kwlist, &rbtid))
744 Py_BEGIN_ALLOW_THREADS
745 globstr =
rpmExpand(
"%{_repackage_dir}/*.rpm", NULL);
747 globstr =
_free(globstr);
751 if (idtx == NULL || idtx->nidt <= 0) {
760 result = PyTuple_New(idtx->nidt);
761 for (i = 0; i < idtx->nidt; i++) {
764 tuple = Py_BuildValue(
"(iOs)", idt->val.u32, ho, idt->key);
765 PyTuple_SET_ITEM(result, i, tuple);
784 QVA_t ia = memset(
alloca(
sizeof(*ia)), 0,
sizeof(*ia));
786 const char ** av = NULL;
789 char * kwlist[] = {
"transactionId", NULL};
792 fprintf(stderr,
"*** rpmts_Rollback(%p) ts %p\n", s, s->
ts);
794 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:Rollback", kwlist, &rbtid))
797 Py_BEGIN_ALLOW_THREADS
811 return Py_BuildValue(
"i", rc);
824 fprintf(stderr,
"*** rpmts_OpenDB(%p) ts %p\n", s, s->
ts);
842 fprintf(stderr,
"*** rpmts_CloseDB(%p) ts %p\n", s, s->
ts);
847 return Py_BuildValue(
"i", rc);
861 fprintf(stderr,
"*** rpmts_InitDB(%p) ts %p\n", s, s->
ts);
867 return Py_BuildValue(
"i", rc);
881 fprintf(stderr,
"*** rpmts_RebuildDB(%p) ts %p\n", s, s->
ts);
883 Py_BEGIN_ALLOW_THREADS
887 return Py_BuildValue(
"i", rc);
901 fprintf(stderr,
"*** rpmts_VerifyDB(%p) ts %p\n", s, s->
ts);
903 Py_BEGIN_ALLOW_THREADS
907 return Py_BuildValue(
"i", rc);
918 PyObject * result = NULL;
923 char * kwlist[] = {
"fd", NULL};
925 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:HdrFromFdno", kwlist,
934 fprintf(stderr,
"*** rpmts_HdrFromFdno(%p) ts %p rc %d\n", s, s->
ts, rpmrc);
940 result = Py_BuildValue(
"N",
hdr_Wrap(h));
946 PyErr_SetString(
pyrpmError,
"public key not available");
950 PyErr_SetString(
pyrpmError,
"public key not trusted");
956 PyErr_SetString(
pyrpmError,
"error reading package header");
973 PyObject * result = NULL;
974 const char * msg = NULL;
979 char * kwlist[] = {
"headers", NULL};
982 fprintf(stderr,
"*** rpmts_HdrCheck(%p) ts %p\n", s, s->
ts);
984 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:HdrCheck", kwlist, &blob))
987 if (blob == Py_None) {
990 if (!(PyString_Check(blob) || PyUnicode_Check(blob))) {
991 PyErr_SetString(
pyrpmError,
"hdrCheck takes a string of octets");
994 uh = PyString_AsString(blob);
995 uc = PyString_Size(blob);
1009 PyErr_SetString(
pyrpmError,
"public key not availaiable");
1013 PyErr_SetString(
pyrpmError,
"public key not trusted");
1042 char * kwlist[] = {
"flags", NULL};
1045 fprintf(stderr,
"*** rpmts_SetVSFlags(%p) ts %p\n", s, s->
ts);
1047 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:SetVSFlags", kwlist,
1065 char * kwlist[] = {
"color", NULL};
1068 fprintf(stderr,
"*** rpmts_SetColor(%p) ts %p\n", s, s->
ts);
1070 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:Color", kwlist, &tscolor))
1088 unsigned char * pkt;
1089 unsigned int pktlen;
1091 char * kwlist[] = {
"octets", NULL};
1094 fprintf(stderr,
"*** rpmts_PgpPrtPkts(%p) ts %p\n", s, s->
ts);
1096 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:PgpPrtPkts", kwlist, &blob))
1099 if (blob == Py_None) {
1102 if (!(PyString_Check(blob) || PyUnicode_Check(blob))) {
1103 PyErr_SetString(
pyrpmError,
"pgpPrtPkts takes a string of octets");
1106 pkt = (
unsigned char *) PyString_AsString(blob);
1107 pktlen = PyString_Size(blob);
1111 return Py_BuildValue(
"i", rc);
1123 unsigned char * pkt;
1124 unsigned int pktlen;
1126 char * kwlist[] = {
"pubkey", NULL};
1129 fprintf(stderr,
"*** rpmts_PgpImportPubkey(%p) ts %p\n", s, s->
ts);
1131 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:PgpImportPubkey",
1135 if (blob == Py_None) {
1138 if (!(PyString_Check(blob) || PyUnicode_Check(blob))) {
1139 PyErr_SetString(
pyrpmError,
"PgpImportPubkey takes a string of octets");
1142 pkt = (
unsigned char *) PyString_AsString(blob);
1143 pktlen = PyString_Size(blob);
1147 return Py_BuildValue(
"i", rc);
1157 char * kwlist[] = {
"flags", NULL};
1159 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:SetFlags", kwlist,
1164 fprintf(stderr,
"*** rpmts_SetFlags(%p) ts %p transFlags 0x%x\n", s, s->
ts, transFlags);
1179 char * kwlist[] = {
"flags", NULL};
1181 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:SetDFlags", kwlist,
1186 fprintf(stderr,
"*** rpmts_SetDFlags(%p) ts %p depFlags 0x%x\n", s, s->
ts, depFlags);
1202 char * kwlist[] = {
"ignoreSet", NULL};
1204 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:ProbFilter", kwlist,
1209 fprintf(stderr,
"*** rpmts_SetProbFilter(%p) ts %p ignoreSet %x\n", s, s->
ts, ignoreSet);
1214 return Py_BuildValue(
"i", oignoreSet);
1226 fprintf(stderr,
"*** rpmts_Problems(%p) ts %p\n", s, s->
ts);
1243 char * kwlist[] = {
"callback",
"data", NULL};
1245 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"OO:Run", kwlist,
1246 &cbInfo.
cb, &cbInfo.
data))
1251 cbInfo.
_save = PyEval_SaveThread();
1253 if (cbInfo.
cb != NULL) {
1254 if (!PyCallable_Check(cbInfo.
cb)) {
1255 PyErr_SetString(PyExc_TypeError,
"expected a callable");
1262 fprintf(stderr,
"*** rpmts_Run(%p) ts %p ignore %x\n", s, s->
ts, s->
ignoreSet);
1270 PyEval_RestoreThread(cbInfo.
_save);
1273 list = PyList_New(0);
1279 list = PyList_New(0);
1290 PyList_Append(list, prob);
1311 fprintf(stderr,
"*** rpmts_Next(%p) ts %p\n", s, s->
ts);
1315 if (result == NULL) {
1330 const char * specfile;
1333 char * passPhrase =
"";
1334 char *cookie = NULL;
1338 char * kwlist[] = {
"specfile", NULL};
1340 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"s:Parse", kwlist, &specfile))
1343 verify =
rpmExpandNumeric(
"%{?_py_parsespec_verify}%{?!_py_parsespec_verify:0}");
1345 if (
parseSpec(s->
ts, specfile,
"/", recursing, passPhrase,
1346 cookie, anyarch, force, verify)!=0) {
1347 PyErr_SetString(
pyrpmError,
"can't parse specfile\n");
1363 PyObject *TagN = NULL;
1364 PyObject *Key = NULL;
1370 char * kwlist[] = {
"tagNumber",
"key", NULL};
1373 fprintf(stderr,
"*** rpmts_Match(%p) ts %p\n", s, s->
ts);
1375 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|OO:Match", kwlist,
1380 PyErr_SetString(PyExc_TypeError,
"unknown tag type");
1386 if (PyString_Check(Key) || PyUnicode_Check(Key)) {
1387 key = PyString_AsString(Key);
1388 len = PyString_Size(Key);
1389 }
else if (PyInt_Check(Key)) {
1390 lkey = PyInt_AsLong(Key);
1391 key = (
char *)&lkey;
1394 PyErr_SetString(PyExc_TypeError,
"unknown key type");
1405 PyErr_SetString(PyExc_TypeError,
"rpmdb open failed");
1420 {
"Debug", (PyCFunction)
rpmts_Debug, METH_VARARGS|METH_KEYWORDS,
1425 {
"addErase", (PyCFunction)
rpmts_AddErase, METH_VARARGS|METH_KEYWORDS,
1427 {
"setDFlags", (PyCFunction)
rpmts_SetDFlags, METH_VARARGS|METH_KEYWORDS,
1428 "ts.setDFlags(depFlags) -> previous depFlags\n\
1429 - Set control bit(s) for executing ts.check() and ts.order().\n" },
1430 {
"check", (PyCFunction)
rpmts_Check, METH_VARARGS|METH_KEYWORDS,
1434 {
"setFlags", (PyCFunction)
rpmts_SetFlags, METH_VARARGS|METH_KEYWORDS,
1435 "ts.setFlags(transFlags) -> previous transFlags\n\
1436 - Set control bit(s) for executing ts.run().\n\
1437 Note: This method replaces the 1st argument to the old ts.run()\n" },
1439 "ts.setProbFilter(ignoreSet) -> previous ignoreSet\n\
1440 - Set control bit(s) for ignoring problems found by ts.run().\n\
1441 Note: This method replaces the 2nd argument to the old ts.run()\n" },
1443 "ts.problems() -> ps\n\
1444 - Return current problem set.\n" },
1445 {
"run", (PyCFunction)
rpmts_Run, METH_VARARGS|METH_KEYWORDS,
1446 "ts.run(callback, data) -> (problems)\n\
1447 - Run a transaction set, returning list of problems found.\n\
1448 Note: The callback may not be None.\n" },
1451 {
"IDTXload", (PyCFunction)
rpmts_IDTXload, METH_VARARGS|METH_KEYWORDS,
1452 "ts.IDTXload(rbtid=iid) -> ((tid,hdr,instance)+)\n\
1453 - Return list of installed packages reverse sorted by transaction id.\n" },
1454 {
"IDTXglob", (PyCFunction)
rpmts_IDTXglob, METH_VARARGS|METH_KEYWORDS,
1455 "ts.IDTXglob(rbtid=rid) -> ((tid,hdr,instance)+)\n\
1456 - Return list of removed packages reverse sorted by transaction id.\n" },
1457 {
"rollback", (PyCFunction)
rpmts_Rollback, METH_VARARGS|METH_KEYWORDS,
1460 "ts.openDB() -> None\n\
1461 - Open the default transaction rpmdb.\n\
1462 Note: The transaction rpmdb is lazily opened, so ts.openDB() is seldom needed.\n" },
1464 "ts.closeDB() -> None\n\
1465 - Close the default transaction rpmdb.\n\
1466 Note: ts.closeDB() disables lazy opens, and should hardly ever be used.\n" },
1468 "ts.initDB() -> None\n\
1469 - Initialize the default transaction rpmdb.\n\
1470 Note: ts.initDB() is seldom needed anymore.\n" },
1472 "ts.rebuildDB() -> None\n\
1473 - Rebuild the default transaction rpmdb.\n" },
1475 "ts.verifyDB() -> None\n\
1476 - Verify the default transaction rpmdb.\n" },
1478 "ts.hdrFromFdno(fdno) -> hdr\n\
1479 - Read a package header from a file descriptor.\n" },
1480 {
"hdrCheck", (PyCFunction)
rpmts_HdrCheck, METH_VARARGS|METH_KEYWORDS,
1483 "ts.getVSFlags() -> vsflags\n\
1484 - Retrieve current signature verification flags from transaction\n" },
1486 "ts.setVSFlags(vsflags) -> ovsflags\n\
1487 - Set signature verification flags. Values for vsflags are:\n\
1488 rpm.RPMVSF_NOHDRCHK if set, don't check rpmdb headers\n\
1489 rpm.RPMVSF_NEEDPAYLOAD if not set, check header+payload (if possible)\n\
1490 rpm.RPMVSF_NOSHA1HEADER if set, don't check header SHA1 digest\n\
1491 rpm.RPMVSF_NODSAHEADER if set, don't check header DSA signature\n\
1492 rpm.RPMVSF_NORSAHEADER if set, don't check header RSA signature\n\
1493 rpm.RPMVSF_NOECDSAHEADER if set, don't check header ECDSA signature\n\
1494 rpm.RPMVSF_NOMD5 if set, don't check header+payload MD5 digest\n\
1495 rpm.RPMVSF_NODSA if set, don't check header+payload DSA signature\n\
1496 rpm.RPMVSF_NORSA if set, don't check header+payload RSA signature\n\
1497 rpm.RPMVSF_NOECDSA if set, don't check header+payload ECDSA signature\n\
1499 {
"setColor",(PyCFunction)
rpmts_SetColor, METH_VARARGS|METH_KEYWORDS,
1505 {
"parseSpec", (PyCFunction)
spec_Parse, METH_VARARGS|METH_KEYWORDS,
1506 "ts.parseSpec(\"/path/to/foo.spec\") -> spec\n\
1507 - Parse a spec file.\n" },
1508 {
"dbMatch", (PyCFunction)
rpmts_Match, METH_VARARGS|METH_KEYWORDS,
1509 "ts.dbMatch([TagN, [key, [len]]]) -> mi\n\
1510 - Create a match iterator for the default transaction rpmdb.\n" },
1511 {
"next", (PyCFunction)
rpmts_Next, METH_NOARGS,
1513 - Retrieve next transaction set element.\n" },
1533 PyObject_Del((PyObject *)s);
1542 char *
name = PyString_AsString(n);
1545 if (!strcmp(name,
"scriptFd")) {
1546 if (!PyArg_Parse(v,
"i", &fdno))
return 0;
1548 PyErr_SetString(PyExc_TypeError,
"bad file descriptor");
1555 PyErr_SetString(PyExc_AttributeError, name);
1589 PyObject_Del((PyObject *)s);
1597 PyObject * s = PyType_GenericAlloc(subtype, nitems);
1600 fprintf(stderr,
"*** rpmts_alloc(%p,%d) ret %p\n", subtype, nitems, s);
1606 static PyObject *
rpmts_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
1612 char * rootDir =
"/";
1614 char * kwlist[] = {
"rootdir",
"vsflags", 0};
1617 fprintf(stderr,
"*** rpmts_init(%p,%p,%p)\n", s, args, kwds);
1619 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|si:rpmts_init", kwlist,
1620 &rootDir, &vsflags))
1638 return (PyObject *)s;
1651 PyVarObject_HEAD_INIT(&PyType_Type, 0)
1667 PyObject_GenericGetAttr,
1672 #
if Py_TPFLAGS_HAVE_ITER
1702 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 const char size_t len
const char * rpmProblemString(const rpmProblem prob)
Return formatted string representation of a problem.
const char bson_timestamp_t * ts
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)
Load tag (instance,value) pairs from packages, and return sorted id index.
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.
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)
const char const bson_bool_t v
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.
const char const bson * data
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
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)
Rollback transactions, erasing new, reinstalling old, package(s).
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)
void rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
IDTX IDTXfree(IDTX idtx)
Destroy id index.
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)
Load tag (instance,value) pairs from rpm databse, and return sorted id index.
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)
const char const bson * key
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.
int(* rpmtsRun)(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
Process all package elements in a transaction set.
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(* rpmtsCheck)(rpmts ts)
Perform dependency resolution on the transaction set.
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(* rpmtsOrder)(rpmts ts)
Determine package order in a transaction set according to dependencies.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
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.