diff mbox series

[opkg,2/3] libopkg: pkg_hash: bump score of packages in cli

Message ID 20221017170358.3628154-3-cotequeiroz@gmail.com
State New
Headers show
Series Rework criteria for dependent package selection | expand

Commit Message

Eneas U de Queiroz Oct. 17, 2022, 5:03 p.m. UTC
When resolving dependencies, packages whose names are listed in the cli
should have a higher priority over other packages picked from the feeds.
Right now a package from the feeds with the same name as the dependency
is given the same score as one present in the cli.  The one looked at
last would be chosen, which is not ideal.

Since packages in the command line are going to be installed anyway,
they should have a higher priority over new ones.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
---
 libopkg/pkg_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git opkglibopkg/pkg_hash.c b/libopkg/pkg_hash.c
index 482efb8..f3fb0c6 100644
--- opkglibopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -427,7 +427,7 @@  pkg_t *pkg_hash_fetch_best_installation_candidate(abstract_pkg_t * apkg,
 
 			for (j = 0; j < opkg_cli_argc; ++j) {
 				if (!strcmp(matching->name, opkg_cli_argv[j])) {
-					score++;
+					score += 2;
 					break;
 				}
 			}