diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-27 14:57:23 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-27 14:57:23 +0900 |
commit | 26ea6e32000a3e6ea392ccc6f8c9d2f51aabd2e4 (patch) | |
tree | 822c0e96e5192dcd23d9e440ec9bf09b963dcbfc /src | |
parent | be2d42493b7600c4bdff046181f1519a3d44b13c (diff) | |
download | libsolv-26ea6e32000a3e6ea392ccc6f8c9d2f51aabd2e4.tar.gz libsolv-26ea6e32000a3e6ea392ccc6f8c9d2f51aabd2e4.tar.bz2 libsolv-26ea6e32000a3e6ea392ccc6f8c9d2f51aabd2e4.zip |
Imported Upstream version 0.6.18upstream/0.6.18
Change-Id: I592f8068e36a01effad5f86c7f5063b4d0bcd213
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/rules.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/rules.c b/src/rules.c index 6f35720..4cd53d3 100644 --- a/src/rules.c +++ b/src/rules.c @@ -417,6 +417,19 @@ addpkgrule(Solver *solv, Id p, Id p2, Id d, int type, Id dep) #ifdef ENABLE_LINKED_PKGS +static int +addlinks_cmp(const void *ap, const void *bp, void *dp) +{ + Pool *pool = dp; + Id a = *(Id *)ap; + Id b = *(Id *)bp; + Solvable *sa = pool->solvables + a; + Solvable *sb = pool->solvables + b; + if (sa->name != sb->name) + return sa->name - sb->name; + return sa - sb; +} + static void addlinks(Solver *solv, Solvable *s, Id req, Queue *qr, Id prv, Queue *qp, Map *m, Queue *workq) { @@ -424,6 +437,8 @@ addlinks(Solver *solv, Solvable *s, Id req, Queue *qr, Id prv, Queue *qp, Map *m int i; if (!qr->count) return; + if (qp->count > 1) + solv_sort(qp->elements, qp->count, sizeof(Id), addlinks_cmp, pool); #if 0 printf("ADDLINKS %s\n -> %s\n", pool_solvable2str(pool, s), pool_dep2str(pool, req)); for (i = 0; i < qr->count; i++) @@ -439,9 +454,17 @@ addlinks(Solver *solv, Solvable *s, Id req, Queue *qr, Id prv, Queue *qp, Map *m addpkgrule(solv, -(s - pool->solvables), 0, pool_queuetowhatprovides(pool, qr), SOLVER_RULE_PKG_REQUIRES, req); if (qp->count > 1) { - Id d = pool_queuetowhatprovides(pool, qp); - for (i = 0; i < qr->count; i++) - addpkgrule(solv, -qr->elements[i], 0, d, SOLVER_RULE_PKG_REQUIRES, prv); + int j; + for (i = j = 0; i < qp->count; i = j) + { + Id d = pool->solvables[qp->elements[i]].name; + for (j = i + 1; j < qp->count; j++) + if (d != pool->solvables[qp->elements[j]].name) + break; + d = pool_ids2whatprovides(pool, qp->elements + i, j - i); + for (i = 0; i < qr->count; i++) + addpkgrule(solv, -qr->elements[i], 0, d, SOLVER_RULE_PKG_REQUIRES, prv); + } } else if (qp->count) { |