Skip to content

Commit 9844673

Browse files
committed
Fix ruleinfo of complex dependencies returning the wrong origin
We order the literals for complex dependencies, so the first literal is not always the origin package. So patch the origin when generating rule infos. Fixes #367
1 parent 102ac55 commit 9844673

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/rules.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ add_complex_deprules(Solver *solv, Id p, Id dep, int type, int dontfix, Queue *w
613613
}
614614
else
615615
{
616-
Id *qele;
616+
Id *qele, d;
617617
int qcnt;
618618

619619
qele = bq.elements + i;
@@ -653,7 +653,17 @@ add_complex_deprules(Solver *solv, Id p, Id dep, int type, int dontfix, Queue *w
653653
break;
654654
if (j < qcnt)
655655
continue;
656-
addpkgrule(solv, qele[0], 0, pool_ids2whatprovides(pool, qele + 1, qcnt - 1), type, dep);
656+
d = pool_ids2whatprovides(pool, qele + 1, qcnt - 1);
657+
if (solv->ruleinfoq && qele[0] != p)
658+
{
659+
int oldcount = solv->ruleinfoq->count;
660+
addpkgrule(solv, qele[0], 0, d, type, dep);
661+
/* fixup from element of ruleinfo */
662+
if (solv->ruleinfoq->count > oldcount)
663+
solv->ruleinfoq->elements[oldcount + 1] = p;
664+
}
665+
else
666+
addpkgrule(solv, qele[0], 0, d, type, dep);
657667
if (m)
658668
for (j = 0; j < qcnt; j++)
659669
if (qele[j] > 0 && !MAPTST(m, qele[j]))
@@ -2729,7 +2739,8 @@ addpkgruleinfo(Solver *solv, Id p, Id p2, Id d, int type, Id dep)
27292739
if (*odp)
27302740
return;
27312741
}
2732-
if (p < 0 && pool->whatprovidesdata[d] < 0 && type == SOLVER_RULE_PKG_CONFLICTS)
2742+
/* set p2 for multiversion conflicts */
2743+
if (p < 0 && pool->whatprovidesdata[d] < 0 && pool->whatprovidesdata[d + 1] >= 0 && type == SOLVER_RULE_PKG_CONFLICTS)
27332744
p2 = pool->whatprovidesdata[d];
27342745
}
27352746
else

0 commit comments

Comments
 (0)