summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2022-02-24 14:15:28 +0200
committerTimo Teräs <timo.teras@iki.fi>2022-02-24 14:36:24 +0200
commit3b013f458225c2ad8a0d96ec3eb3dde2533e0312 (patch)
treeabf3333c86704952cd9ae9e7b49e8d05192026b5 /src
parentcfe72c6fc4770c0bfba48660d88c65f0f923e479 (diff)
downloadapk-tools-3b013f458225c2ad8a0d96ec3eb3dde2533e0312.tar.gz
apk-tools-3b013f458225c2ad8a0d96ec3eb3dde2533e0312.tar.bz2
apk-tools-3b013f458225c2ad8a0d96ec3eb3dde2533e0312.tar.xz
apk-tools-3b013f458225c2ad8a0d96ec3eb3dde2533e0312.zip
solver: do not auto select virtual-only package with one provider
This reverts most of 0dcbd933 which allowed automatic selection of package with a "virtual provides" having only one provider. While convenient, it creates problems if multiple versions of the same package exist, or if in future other providers would be added to one of the repositories. This restore the original behaviour, and improve the error message to tell the user to mention one of the providers explicitly. fixes #10810
Diffstat (limited to 'src')
-rw-r--r--src/commit.c4
-rw-r--r--src/solver.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/commit.c b/src/commit.c
index e9b6dbe..833ecfe 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -533,6 +533,10 @@ static void analyze_name(struct print_state *ps, struct apk_name *name)
snprintf(tmp, sizeof(tmp), "%s (virtual)", name->name);
ps->label = tmp;
+ label_start(ps, "note:");
+ apk_print_indented_words(&ps->i, "please select one of the 'provided by' packages explicitly");
+ label_end(ps);
+
label_start(ps, "provided by:");
foreach_array_item(p0, name->providers)
p0->pkg->name->state_int++;
diff --git a/src/solver.c b/src/solver.c
index 810c9ce..06dfb6b 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -714,8 +714,8 @@ static void select_package(struct apk_solver_state *ss, struct apk_name *name)
if (p->version == &apk_atom_null &&
p->pkg->name->auto_select_virtual == 0 &&
p->pkg->name->ss.requirers == 0 &&
- (p->pkg->provider_priority == 0 && name->providers->num > 1)) {
- dbg_printf(" ignore: virtual package without provider_priority with >1 provider\n");
+ p->pkg->provider_priority == 0) {
+ dbg_printf(" ignore: virtual package without provider_priority\n");
continue;
}
if (compare_providers(ss, p, &chosen) > 0) {