aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2017-11-02 16:31:50 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2017-11-02 16:31:50 +0000
commit0a17a648db0e9df61f9bea9d5be292a98106dc6a (patch)
tree5c4157992b50e70a16644094d2aa42c7dd9ecb93
parent9165aa3894bcf19f36be16d733f75eb997becd4f (diff)
downloadaports-0a17a648db0e9df61f9bea9d5be292a98106dc6a.tar.bz2
aports-0a17a648db0e9df61f9bea9d5be292a98106dc6a.tar.xz
solver: only select a default if there is at least one provider with a declared provider_priority
-rw-r--r--src/solver.c6
-rw-r--r--test/provides.repo17
-rw-r--r--test/provides9.test9
3 files changed, 31 insertions, 1 deletions
diff --git a/src/solver.c b/src/solver.c
index 17dbdd2dca..c7c9983f30 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -668,6 +668,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 */
+ if (p->version == &apk_null_blob &&
+ p->pkg->name->auto_select_virtual == 0 &&
+ p->pkg->name->ss.requirers == 0 &&
+ p->pkg->provider_priority == 0)
+ continue;
if (compare_providers(ss, p, &chosen) > 0)
chosen = *p;
}
diff --git a/test/provides.repo b/test/provides.repo
index 8bc0c62910..69f18cb2a7 100644
--- a/test/provides.repo
+++ b/test/provides.repo
@@ -38,6 +38,7 @@ V:1
S:1
I:1
p:mail-reader
+k:1
C:Q1eVpkasfqZAukAXFYbgwt4xAEEEe=
P:mailreadplus
@@ -45,7 +46,7 @@ V:1
S:1
I:1
p:mail-reader
-k:1
+k:2
C:Q1EyN5AdpAOBJWKMR89pp/C77FFFF=
P:server-a
@@ -68,3 +69,17 @@ S:1
I:1
p:selfprovided=2
p:selfprovided=3
+
+C:Q1EyN5AdpAOBJWKMR89ppC66aaaaj=
+P:conflicted-provider-a
+V:0.1
+S:1
+I:1
+p:conflicted-provider
+
+C:Q1EyN5AdpAOBJWKMR89ppC66bbbbj=
+P:conflicted-provider-b
+V:0.1
+S:1
+I:1
+p:conflicted-provider
diff --git a/test/provides9.test b/test/provides9.test
new file mode 100644
index 0000000000..f85a3679a2
--- /dev/null
+++ b/test/provides9.test
@@ -0,0 +1,9 @@
+@ARGS
+--test-repo provides.repo
+add conflicted-provider
+@EXPECT
+ERROR: unsatisfiable constraints:
+ conflicted-provider (virtual):
+ provided by: conflicted-provider-a
+ conflicted-provider-b
+ required by: world[conflicted-provider]