diff --git a/src/solver.c b/src/solver.c index 91e5958..d27a7a3 100644 --- a/src/solver.c +++ b/src/solver.c @@ -671,11 +671,12 @@ static void select_package(struct apk_solver_state *ss, struct apk_name *name) (!p->pkg->ss.iif_triggered || !p->pkg->ss.tag_ok)) continue; - /* Virtual packages without provider_priority cannot be autoselected */ + /* Virtual packages without provider_priority cannot be autoselected, + * unless there is only one provider */ if (p->version == &apk_null_blob && p->pkg->name->auto_select_virtual == 0 && p->pkg->name->ss.requirers == 0 && - p->pkg->provider_priority == 0) + (p->pkg->provider_priority == 0 && name->providers->num > 1)) continue; if (compare_providers(ss, p, &chosen) > 0) chosen = *p; diff --git a/test/provides.repo b/test/provides.repo index 58bd416..358151e 100644 --- a/test/provides.repo +++ b/test/provides.repo @@ -82,7 +82,7 @@ P:conflicted-provider-b V:0.1 S:1 I:1 -p:conflicted-provider +p:conflicted-provider conflicted-provider-2 C:Q1EyN5AdpAOBJWKMR89ppC66ccccj= P:conflicted-dep @@ -104,3 +104,10 @@ V:0.1 S:1 I:1 p:self-provide + +C:Q1EyN5AdpAOBJWKMR89ppC66eeeej= +P:conflicted-dep-2 +V:0.1 +S:1 +I:1 +D:conflicted-provider-2