summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/depends.c12
-rw-r--r--python/header-py.c27
-rw-r--r--python/rpmmodule.c14
3 files changed, 37 insertions, 16 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 6ce2c3843..39150d3a7 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -1160,7 +1160,8 @@ static int orderListIndexCmp(const void * one, const void * two) /*@*/
/*@-mustmod@*/
static void addQ(/*@dependent@*/ rpmte p,
/*@in@*/ /*@out@*/ rpmte * qp,
- /*@in@*/ /*@out@*/ rpmte * rp)
+ /*@in@*/ /*@out@*/ rpmte * rp,
+ uint_32 prefcolor)
/*@modifies p, *qp, *rp @*/
{
rpmte q, qprev;
@@ -1180,6 +1181,10 @@ static void addQ(/*@dependent@*/ rpmte p,
q != NULL;
qprev = q, q = rpmteTSI(q)->tsi_suc)
{
+ /* XXX Insure preferred color first. */
+ if (rpmteColor(p) != prefcolor && rpmteColor(p) != rpmteColor(q))
+ continue;
+
if (rpmteTSI(q)->tsi_qcnt <= rpmteTSI(p)->tsi_qcnt)
break;
}
@@ -1208,6 +1213,7 @@ int rpmtsOrder(rpmts ts)
rpmds requires;
int_32 Flags;
int anaconda = rpmtsFlags(ts) & RPMTRANS_FLAG_ANACONDA;
+ uint_32 prefcolor = rpmtsPrefColor(ts);
rpmtsi pi; rpmte p;
rpmtsi qi; rpmte q;
rpmtsi ri; rpmte r;
@@ -1370,7 +1376,7 @@ rescan:
if (rpmteTSI(p)->tsi_count != 0)
continue;
rpmteTSI(p)->tsi_suc = NULL;
- addQ(p, &q, &r);
+ addQ(p, &q, &r, prefcolor);
qlen++;
}
pi = rpmtsiFree(pi);
@@ -1441,7 +1447,7 @@ rescan:
/* XXX TODO: add control bit. */
rpmteTSI(p)->tsi_suc = NULL;
- addQ(p, &rpmteTSI(q)->tsi_suc, &r);
+ addQ(p, &rpmteTSI(q)->tsi_suc, &r, prefcolor);
qlen++;
}
tsi = _free(tsi);
diff --git a/python/header-py.c b/python/header-py.c
index e74077ea8..ff2331693 100644
--- a/python/header-py.c
+++ b/python/header-py.c
@@ -347,19 +347,6 @@ static struct PyMethodDef hdr_methods[] = {
{NULL, NULL} /* sentinel */
};
-static PyObject * hdr_getattro(PyObject * o, PyObject * n)
- /*@*/
-{
- return PyObject_GenericGetAttr(o, n);
-}
-
-static int hdr_setattro(PyObject * o, PyObject * n, PyObject * v)
- /*@*/
-{
- return PyObject_GenericSetAttr(o, n, v);
-}
-
-
/** \ingroup py_c
*/
static void hdr_dealloc(hdrObject * s)
@@ -542,6 +529,20 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item)
return o;
}
+static PyObject * hdr_getattro(PyObject * o, PyObject * n)
+{
+ PyObject * res;
+ res = PyObject_GenericGetAttr(o, n);
+ if (res == NULL)
+ res = hdr_subscript(o, n);
+ return res;
+}
+
+static int hdr_setattro(PyObject * o, PyObject * n, PyObject * v)
+{
+ return PyObject_GenericSetAttr(o, n, v);
+}
+
/** \ingroup py_c
*/
/*@unchecked@*/ /*@observer@*/
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index 812521cf3..2a0ee11d1 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -44,6 +44,18 @@ PyObject * pyrpmError;
/**
*/
+static PyObject * expandMacro(PyObject * self, PyObject * args, PyObject * kwds)
+{
+ char * macro;
+
+ if (!PyArg_ParseTuple(args, "s", &macro))
+ return NULL;
+
+ return Py_BuildValue("s", rpmExpand(macro, NULL));
+}
+
+/**
+ */
static PyObject * archScore(PyObject * self, PyObject * args, PyObject * kwds)
{
char * arch;
@@ -187,6 +199,8 @@ static PyMethodDef rpmModuleMethods[] = {
NULL },
{ "delMacro", (PyCFunction) rpmrc_DelMacro, METH_VARARGS|METH_KEYWORDS,
NULL },
+ { "expandMacro", (PyCFunction) expandMacro, METH_VARARGS|METH_KEYWORDS,
+ NULL },
{ "archscore", (PyCFunction) archScore, METH_VARARGS|METH_KEYWORDS,
NULL },