There's a deep political rift aka labelCompare() involving missing values that needs to be sorted through here.
The same political rift affects your "fix" with missing values (my comment was something arch like "You changed too many lines of code and there needs to be test cases first." I can find the explicit message if you don't recall) The political rift is largely that the python script kiddies and labelCompare() are doing things differently than what RPM is doing. The issue is solely that there are different conventions for missing values that prevent otherwise identical code from being collapsed through re-factoring. But its not my job to teach script kiddies how to program or otherwise relieve them of their ignorance. Lord knows I've tried to do so for years and years and years. *shrug*. Meanwhile I no longer give a rat's ass crap about legacy. But you might want to coordinate the change with Ander's and smart before we have Yet Another Food Fight in the rpm-python cafeteria. hth 73 de Jeff On Jan 27, 2011, at 1:24 PM, Per Øyvind Karlsen wrote: > RPM Package Manager, CVS Repository > http://rpm5.org/cvs/ > ____________________________________________________________________________ > > Server: rpm5.org Name: Per Øyvind Karlsen > Root: /v/rpm/cvs Email: pkarl...@rpm5.org > Module: rpm Date: 27-Jan-2011 19:24:42 > Branch: HEAD Handle: 2011012718244100 > > Modified files: > rpm CHANGES > rpm/python header-py.c header-py.h rpmmodule.c > > Log: > python: export rpmEVRparse() & rpmEVRcompare() in evrSplit() & > evrcompare() > > Summary: > Revision Changes Path > 1.3557 +2 -0 rpm/CHANGES > 1.113 +38 -0 rpm/python/header-py.c > 1.19 +10 -0 rpm/python/header-py.h > 1.181 +4 -0 rpm/python/rpmmodule.c > ____________________________________________________________________________ > > patch -p0 <<'@@ .' > Index: rpm/CHANGES > ============================================================================ > $ cvs diff -u -r1.3556 -r1.3557 CHANGES > --- rpm/CHANGES 27 Jan 2011 17:28:57 -0000 1.3556 > +++ rpm/CHANGES 27 Jan 2011 18:24:41 -0000 1.3557 > @@ -1,4 +1,6 @@ > 5.4.0 -> 5.4.1: > + - proyvind: python: export rpmEVRparse() & rpmEVRcompare() in > evrSplit() & > + evrCompare(). > - proyvind: fix return code for ignored signals breaking ie. rpmbuild > with > gnome-terminal (mdvbz#62262) > - proyvind: add tools/dbconvert for rpmdb conversion to/from hash/btree > & > @@ . > patch -p0 <<'@@ .' > Index: rpm/python/header-py.c > ============================================================================ > $ cvs diff -u -r1.112 -r1.113 header-py.c > --- rpm/python/header-py.c 27 Jan 2011 18:16:24 -0000 1.112 > +++ rpm/python/header-py.c 27 Jan 2011 18:24:41 -0000 1.113 > @@ -968,3 +968,41 @@ > > return Py_BuildValue("i", rc); > } > + > +PyObject * evrCompare (PyObject * self, PyObject * args, > + PyObject * kwds) > +{ > + EVR_t lEVR = rpmEVRnew(RPMSENSE_EQUAL, 0), > + rEVR = rpmEVRnew(RPMSENSE_EQUAL, 0); > + int rc; > + char * evr1, * evr2; > + char * kwlist[] = {"evr0", "evr1", NULL}; > + > + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss", kwlist, &evr1, > &evr2)) > + return NULL; > + > + rpmEVRparse(evr1, lEVR); > + rpmEVRparse(evr2, rEVR); > + rc = rpmEVRcompare(lEVR, rEVR); > + lEVR = rpmEVRfree(lEVR); > + rEVR = rpmEVRfree(rEVR); > + > + return PyLong_FromLong(rc); > +} > + > +PyObject * evrSplit (PyObject * self, PyObject * args, PyObject * kwds) > +{ > + EVR_t EVR = rpmEVRnew(RPMSENSE_EQUAL, 0); > + char * evr; > + char * kwlist[] = {"evr", NULL}; > + PyObject * tuple; > + > + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &evr)) > + return NULL; > + > + rpmEVRparse(evr, EVR); > + tuple = Py_BuildValue("(Isss)", EVR->F[RPMEVR_E] ? > atoi(EVR->F[RPMEVR_E]) : 0, EVR->F[RPMEVR_V], EVR->F[RPMEVR_R], > EVR->F[RPMEVR_D]); > + EVR = rpmEVRfree(EVR); > + > + return tuple; > +} > @@ . > patch -p0 <<'@@ .' > Index: rpm/python/header-py.h > ============================================================================ > $ cvs diff -u -r1.18 -r1.19 header-py.h > --- rpm/python/header-py.h 8 Dec 2008 01:20:02 -0000 1.18 > +++ rpm/python/header-py.h 27 Jan 2011 18:24:41 -0000 1.19 > @@ -42,6 +42,16 @@ > > /** \ingroup py_c > */ > +PyObject * evrSplit (PyObject * self, PyObject * args, PyObject * kwds) > + /*@*/; > + > +/** \ingroup py_c > + */ > +PyObject * evrCompare (PyObject * self, PyObject * args, PyObject * kwds) > + /*@*/; > + > +/** \ingroup py_c > + */ > PyObject * labelCompare (PyObject * self, PyObject * args) > /*@*/; > > @@ . > patch -p0 <<'@@ .' > Index: rpm/python/rpmmodule.c > ============================================================================ > $ cvs diff -u -r1.180 -r1.181 rpmmodule.c > --- rpm/python/rpmmodule.c 1 Dec 2010 16:46:03 -0000 1.180 > +++ rpm/python/rpmmodule.c 27 Jan 2011 18:24:41 -0000 1.181 > @@ -256,6 +256,10 @@ > NULL }, > { "labelCompare", (PyCFunction) labelCompare, > METH_VARARGS|METH_KEYWORDS, > NULL }, > + { "evrCompare", (PyCFunction) evrCompare, METH_VARARGS|METH_KEYWORDS, > + NULL }, > + { "evrSplit", (PyCFunction) evrSplit, METH_VARARGS|METH_KEYWORDS, > + NULL }, > { "setVerbosity", (PyCFunction) setVerbosity, > METH_VARARGS|METH_KEYWORDS, > NULL }, > { "setEpochPromote", (PyCFunction) setEpochPromote, > METH_VARARGS|METH_KEYWORDS, > @@ . > ______________________________________________________________________ > RPM Package Manager http://rpm5.org > CVS Sources Repository rpm-...@rpm5.org ______________________________________________________________________ RPM Package Manager http://rpm5.org Developer Communication List rpm-devel@rpm5.org