Set `priorized_matching` to the latest provider with maximum priority, such
that it is similar to the other selections (especially `good_pkg_by_name`).
So, we have consistency between using `opkg install apkg` and installing a
package that `DEPENDS:=+apkg` (if there are two providers for `apkg`).

Signed-off-by: Peter Stadler <peter.stad...@student.uibk.ac.at>
---
 libopkg/pkg_hash.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index 52c64ff..9b22f01 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -410,10 +410,15 @@ pkg_t 
*pkg_hash_fetch_best_installation_candidate(abstract_pkg_t * apkg,
                if (constraint_fcn(matching, cdata)) {
                        opkg_msg(DEBUG, "Candidate: %s %s.\n",
                                 matching->name, pkg_get_string(matching, 
PKG_VERSION));
-                       good_pkg_by_name = matching;
+                       /* Select the first (the same as for 
priorized_matching) */
+                       if (good_pkg_by_name == NULL) {
+                               good_pkg_by_name = matching;
+                        }
                        /* It has been provided by hand, so it is what user 
want */
-                       if (matching->provided_by_hand == 1)
+                       if (matching->provided_by_hand == 1) {
+                               good_pkg_by_name = matching;
                                break;
+                       }
                }
        }
 
-- 
2.25.3


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to