return 0;
}
-int rpmtsGetKeys(const rpmts ts, fnpyKey ** ep, int * nep)
-{
- int rc = 0;
-
- if (nep) *nep = ts->orderCount;
- if (ep) {
- rpmtsi pi; rpmte p;
- fnpyKey * e;
-
- *ep = e = xmalloc(ts->orderCount * sizeof(*e));
- pi = rpmtsiInit(ts);
- while ((p = rpmtsiNext(pi, 0)) != NULL) {
- switch (rpmteType(p)) {
- case TR_ADDED:
- *e = rpmteKey(p);
- break;
- case TR_REMOVED:
- default:
- *e = NULL;
- break;
- }
- e++;
- }
- pi = rpmtsiFree(pi);
- }
- return rc;
-}
-
rpmts rpmtsCreate(void)
{
rpmts ts;
*/
int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset);
-/** \ingroup rpmts
- * Retrieve keys from ordered transaction set.
- * @todo Removed packages have no keys, returned as interleaved NULL pointers.
- * @param ts transaction set
- * @retval ep address of returned element array pointer (or NULL)
- * @retval nep address of no. of returned elements (or NULL)
- * @return 0 always
- */
-int rpmtsGetKeys(rpmts ts,
- fnpyKey ** ep,
- int * nep);
-
#ifdef __cplusplus
}
#endif
return Py_BuildValue("i", rc);
}
-static PyObject *
-rpmts_GetKeys(rpmtsObject * s)
-{
- const void **data = NULL;
- int num, i;
- PyObject *tuple;
-
- rpmtsGetKeys(s->ts, &data, &num);
- if (data == NULL || num <= 0) {
- data = _free(data);
- Py_RETURN_NONE;
- }
-
- tuple = PyTuple_New(num);
-
- for (i = 0; i < num; i++) {
- PyObject *obj;
- obj = (data[i] ? (PyObject *) data[i] : Py_None);
- Py_INCREF(obj);
- PyTuple_SetItem(tuple, i, obj);
- }
-
- data = _free(data);
-
- return tuple;
-}
-
static void *
rpmtsCallback(const void * hd, const rpmCallbackType what,
const rpm_loff_t amount, const rpm_loff_t total,
NULL },
{"pgpImportPubkey", (PyCFunction) rpmts_PgpImportPubkey, METH_VARARGS|METH_KEYWORDS,
NULL },
- {"getKeys", (PyCFunction) rpmts_GetKeys, METH_NOARGS,
- NULL },
{"dbMatch", (PyCFunction) rpmts_Match, METH_VARARGS|METH_KEYWORDS,
"ts.dbMatch([TagN, [key, [len]]]) -> mi\n\
- Create a match iterator for the default transaction rpmdb.\n" },