Message ID | 20200716142855.77226-1-peter.stadler@student.uibk.ac.at |
---|---|
State | Not Applicable |
Headers | show |
Series | opkg: prioritize the latest provider (not the first) | expand |
Sorry, this is the wrong patch. Please ignore it. On 16.07.20 16:28, Peter Stadler wrote: > 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.stadler@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; > + } > } > } >
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; + } } }
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.stadler@student.uibk.ac.at> --- libopkg/pkg_hash.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)