summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-03-08 13:28:32 +0200
committerPanu Matilainen <pmatilai@redhat.com>2011-03-08 13:28:32 +0200
commit4a16d55f1f689ab06e8dd45c50b86e478a732367 (patch)
tree2d82a0c34f857ac64c0ba061c543b7d10cb8f03d
parente0ddd282033b23fdcef47f8cbdfcae5c87892797 (diff)
downloadlibrpm-tizen-4a16d55f1f689ab06e8dd45c50b86e478a732367.tar.gz
librpm-tizen-4a16d55f1f689ab06e8dd45c50b86e478a732367.tar.bz2
librpm-tizen-4a16d55f1f689ab06e8dd45c50b86e478a732367.zip
Preferred color pkgs should be erased last
- On install we need to queue preferred colored pkgs before others to account for the way colored files get laid on disk. On erase, we need to revert this for the same reason. Most of the time dependencies take care of this, but the queue placement matters in cases such as RhBug:680261 where the order is not dependency-driven.
-rw-r--r--lib/order.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/order.c b/lib/order.c
index 3b0849d46..18fe05ccc 100644
--- a/lib/order.c
+++ b/lib/order.c
@@ -208,6 +208,8 @@ static void addQ(tsortInfo p, tsortInfo * qp, tsortInfo * rp,
rpm_color_t prefcolor)
{
tsortInfo q, qprev;
+ rpm_color_t pcolor = rpmteColor(p->te);
+ int tailcond;
/* Mark the package as queued. */
p->tsi_reqx = 1;
@@ -218,13 +220,18 @@ static void addQ(tsortInfo p, tsortInfo * qp, tsortInfo * rp,
return;
}
- /* Find location in queue using metric tsi_qcnt. */
+ if (rpmteType(p->te) == TR_ADDED)
+ tailcond = (pcolor && pcolor != prefcolor);
+ else
+ tailcond = (pcolor && pcolor == prefcolor);
+
+ /* Find location in queue using metric tsi_qcnt and color. */
for (qprev = NULL, q = (*qp);
q != NULL;
qprev = q, q = q->tsi_suc)
{
- /* XXX Insure preferred color first. */
- if (rpmteColor(p->te) != prefcolor && rpmteColor(p->te) != rpmteColor(q->te))
+ /* Place preferred color towards queue head on install, tail on erase */
+ if (tailcond && (pcolor != rpmteColor(q->te)))
continue;
if (q->tsi_qcnt <= p->tsi_qcnt)