45 if (*epoch ==
'\0') epoch =
"0";
61 if (vp) *vp = version;
62 if (rp) *rp = release;
71 else if (str1 && !str2)
73 else if (!str1 && str2)
83 const char *aE, *aV, *aR;
85 const char *bE, *bV, *bR;
115 rc = (rc < 0 ? -1 : (rc == 0 ? 1 : 0));
127 return Py_BuildValue(
"i", rc);
135 return (PyObject *)s;
143 PyObject * result = NULL;
160 if (EVR != NULL) EVR =
xstrdup(EVR);
184 if (result == NULL) {
197 char * kwlist[] = {
"debugLevel", NULL};
199 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i", kwlist, &
_rpmds_debug))
219 return Py_BuildValue(
"i",
rpmdsIx(s->
ds));
235 return Py_BuildValue(
"s",
rpmdsN(s->
ds));
259 return Py_BuildValue(
"i", (
int)
rpmdsBT(s->
ds));
299 char * kwlist[] = {
"noPromote", NULL};
301 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"i:SetNoPromote", kwlist,
316 char * kwlist[] = {
"location",
"returnCode", NULL};
318 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"si:Notify", kwlist,
349 PyObject * to = NULL;
351 char * kwlist[] = {
"element", NULL};
353 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:Find", kwlist, &to))
370 PyObject * to = NULL;
372 char * kwlist[] = {
"element", NULL};
374 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:Merge", kwlist, &to))
387 PyObject * to = NULL;
389 char * kwlist[] = {
"element", NULL};
391 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:Merge", kwlist, &to))
472 rpmds_Compare(
rpmdsObject * s, PyObject * args, PyObject * kwds)
475 PyObject * to = NULL;
477 char * kwlist[] = {
"other", NULL};
479 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O:Compare", kwlist, &to))
492 if (!PyArg_ParseTuple(args,
":Problem"))
504 {
"Debug", (PyCFunction)
rpmds_Debug, METH_VARARGS|METH_KEYWORDS,
507 "ds.Count -> Count - Return no. of elements.\n" },
508 {
"Ix", (PyCFunction)
rpmds_Ix, METH_NOARGS,
509 "ds.Ix -> Ix - Return current element index.\n" },
511 "ds.DNEVR -> DNEVR - Return current DNEVR.\n" },
512 {
"N", (PyCFunction)
rpmds_N, METH_NOARGS,
513 "ds.N -> N - Return current N.\n" },
514 {
"EVR", (PyCFunction)
rpmds_EVR, METH_NOARGS,
515 "ds.EVR -> EVR - Return current EVR.\n" },
517 "ds.Flags -> Flags - Return current Flags.\n" },
518 {
"BT", (PyCFunction)
rpmds_BT, METH_NOARGS,
519 "ds.BT -> BT - Return build time.\n" },
520 {
"TagN", (PyCFunction)
rpmds_TagN, METH_NOARGS,
521 "ds.TagN -> TagN - Return current TagN.\n" },
523 "ds.Color -> Color - Return current Color.\n" },
524 {
"Refs", (PyCFunction)
rpmds_Refs, METH_NOARGS,
525 "ds.Refs -> Refs - Return current Refs.\n" },
527 "ds.Result -> Result - Return current Result.\n" },
528 {
"next", (PyCFunction)
rpmds_Next, METH_NOARGS,
529 "ds.next() -> (N, EVR, Flags)\n\
530 - Retrieve next dependency triple.\n" },
533 {
"Notify", (PyCFunction)
rpmds_Notify, METH_VARARGS|METH_KEYWORDS,
535 {
"Sort", (PyCFunction)
rpmds_Sort, METH_NOARGS,
536 "ds.Sort() -> None\n\
537 - Sort the (N,EVR,Flags) elements in ds\n" },
538 {
"Find", (PyCFunction)
rpmds_Find, METH_VARARGS|METH_KEYWORDS,
539 "ds.Find(element) -> matching ds index (-1 on failure)\n\
540 - Check for an exactly matching element in ds.\n\
541 The current index in ds is positioned at matching member upon success.\n" },
542 {
"Merge", (PyCFunction)
rpmds_Merge, METH_VARARGS|METH_KEYWORDS,
543 "ds.Merge(elements) -> 0 on success\n\
544 - Merge elements into ds, maintaining (N,EVR,Flags) sort order.\n" },
545 {
"Search", (PyCFunction)
rpmds_Search, METH_VARARGS|METH_KEYWORDS,
546 "ds.Search(element) -> matching ds index (-1 on failure)\n\
547 - Check that element dependency range overlaps some member of ds.\n\
548 The current index in ds is positioned at overlapping member upon success.\n" },
549 {
"Cpuinfo", (PyCFunction)
rpmds_Cpuinfo, METH_NOARGS|METH_STATIC,
550 "ds.Cpuinfo -> nds - Return /proc/cpuinfo dependency set.\n"},
551 {
"Rpmlib", (PyCFunction)
rpmds_Rpmlib, METH_NOARGS|METH_STATIC,
552 "ds.Rpmlib -> nds - Return internal rpmlib dependency set.\n"},
553 {
"Sysinfo", (PyCFunction)
rpmds_Sysinfo, METH_NOARGS|METH_STATIC,
554 "ds.Sysinfo -> nds - Return /etc/rpm/sysinfo dependency set.\n"},
555 {
"Getconf", (PyCFunction)
rpmds_Getconf, METH_NOARGS|METH_STATIC,
556 "ds.Getconf -> nds - Return getconf(1) dependency set.\n"},
557 {
"Ldconfig", (PyCFunction)
rpmds_Ldconfig, METH_NOARGS|METH_STATIC,
558 "ds.Ldconfig -> nds - Return /etc/ld.so.cache dependency set.\n"},
560 {
"Compare", (PyCFunction)rpmds_Compare, METH_VARARGS|METH_KEYWORDS,
562 {
"Problem", (PyCFunction)rpmds_Problem, METH_NOARGS,
598 return PyObject_GenericGetAttr(o, n);
604 return PyObject_GenericSetAttr(o, n, v);
621 if (!PyInt_Check(key)) {
622 PyErr_SetString(PyExc_TypeError,
"integer expected");
626 ix = (int) PyInt_AsLong(key);
646 PyObject * to = NULL;
649 char * kwlist[] = {
"header",
"tag",
"flags", NULL};
652 fprintf(stderr,
"*** rpmds_init(%p,%p,%p)\n", s, args, kwds);
654 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!|Oi:rpmds_init", kwlist,
661 PyErr_SetString(PyExc_KeyError,
"unknown header tag");
677 fprintf(stderr,
"%p -- ds %p\n", s, s->
ds);
680 PyObject_Del((PyObject *)s);
688 PyObject * s = PyType_GenericAlloc(subtype, nitems);
691 fprintf(stderr,
"*** rpmds_alloc(%p,%d) ret %p\n", subtype, nitems, s);
698 static PyObject *
rpmds_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
711 fprintf(stderr,
"%p ++ ds %p\n", s, s->
ds);
713 return (PyObject *)s;
724 PyObject_HEAD_INIT(&PyType_Type)
746 Py_TPFLAGS_HAVE_RICHCOMPARE,
748 #if Py_TPFLAGS_HAVE_ITER
795 PyObject * to = NULL;
798 const char * EVR = NULL;
800 char * kwlist[] = {
"to",
"name",
"evr",
"flags", NULL};
802 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"Os|si:Single", kwlist,
803 &to, &N, &EVR, &Flags))
809 PyErr_SetString(PyExc_KeyError,
"unknown header tag");
814 if (EVR != NULL) EVR =
xstrdup(EVR);
822 PyObject * to = NULL;
825 char * kwlist[] = {
"to",
"flags", NULL};
827 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"|Oi:dsFromHeader", kwlist,
834 PyErr_SetString(PyExc_KeyError,
"unknown header tag");