summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2018-11-12 14:16:36 +0200
committerTimo Teräs <timo.teras@iki.fi>2018-11-12 14:16:36 +0200
commit47570f80e9f6bf1f3a41bc6e13ec4bf17849c809 (patch)
treea4f9269d9782328eb793a74e44f5e0b910d44510 /src/database.c
parenta86c8ed0828f670b875b418ef10d83bddeca97f6 (diff)
downloadapk-tools-47570f80e9f6bf1f3a41bc6e13ec4bf17849c809.tar.gz
apk-tools-47570f80e9f6bf1f3a41bc6e13ec4bf17849c809.tar.bz2
apk-tools-47570f80e9f6bf1f3a41bc6e13ec4bf17849c809.tar.xz
apk-tools-47570f80e9f6bf1f3a41bc6e13ec4bf17849c809.zip
prefer selecting packages by their primary name
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index 91fcedd..33cd32a 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1439,9 +1439,11 @@ static int apk_db_name_rdepends(apk_hash_item item, void *pctx)
struct apk_provider *p;
struct apk_dependency *dep;
struct apk_name_array *touched;
+ unsigned num_virtual = 0;
apk_name_array_init(&touched);
foreach_array_item(p, name->providers) {
+ num_virtual += (p->pkg->name != name);
foreach_array_item(dep, p->pkg->depends) {
rname = dep->name;
rname->is_dependency |= !dep->conflict;
@@ -1460,6 +1462,12 @@ static int apk_db_name_rdepends(apk_hash_item item, void *pctx)
}
}
}
+ if (num_virtual == 0)
+ name->priority = 0;
+ else if (num_virtual != name->providers->num)
+ name->priority = 1;
+ else
+ name->priority = 2;
foreach_array_item(n0, touched)
(*n0)->state_int = 0;
apk_name_array_free(&touched);