summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2023-11-15 16:44:23 +0200
committerTimo Teräs <timo.teras@iki.fi>2023-11-15 16:44:23 +0200
commitec2ca333301bd292dc956ca42957cee9376bf2ee (patch)
treed5ae82c45a837cd0416090418341d2b8d09d2f42
parent3bf521ba06711394d6ac8a12e5e55b452a7e5107 (diff)
downloadapk-tools-master.tar.gz
apk-tools-master.tar.bz2
apk-tools-master.tar.xz
apk-tools-master.zip
fetch: prefer fetching package with the concrete namemaster
Instead of a package just providing the name
-rw-r--r--src/app_fetch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/app_fetch.c b/src/app_fetch.c
index 03c4b2a..1e188c1 100644
--- a/src/app_fetch.c
+++ b/src/app_fetch.c
@@ -294,9 +294,12 @@ static int mark_name(struct apk_database *db, const char *match, struct apk_name
if (!name) goto err;
- foreach_array_item(p, name->providers)
- if (pkg == NULL || apk_pkg_version_compare(p->pkg, pkg) == APK_VERSION_GREATER)
+ foreach_array_item(p, name->providers) {
+ if (pkg == NULL ||
+ (p->pkg->name == name && pkg->name != name) ||
+ apk_pkg_version_compare(p->pkg, pkg) == APK_VERSION_GREATER)
pkg = p->pkg;
+ }
if (!pkg) goto err;
mark_package(ctx, pkg);