dskvr / opkg

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

Fix pkg_hash_fetch_best_installation_candidate usage #141

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I think I have a fix for some of this but I want to document it anyway.

Looking at opkg v0.2.2:

There seems to be some confusion in the use of this constraint function in 
pkg_hash_fetch_best_installation_candidate. The current usage makes sense when 
we consider pkg_hash_fetch_best_installation_candidate_by_name, where the 
constraint function is pkg_name_constraint_fcn. In this case, good_pkg_by_name 
can only be set if the constraint function passes. good_pkg_by_name then takes 
priority over latest_matching and thus an explicit name match is preferred to 
an implicit name match (where apkg->name matches but pkg->name doesn't). 
However, an implicit match is still allowed as latest_matching will be returned 
if nothing passes the constraint function.

The usage of pkg_hash_fetch_best_installation_candidate from 
pkg_hash_fetch_unsatisfied_dependencies and 
pkg_hash_fetch_satisfied_dependencies is different though. They attempt to use 
the constraint function as a hard constraint, but that doesn't work so there is 
another check of this constraint afterwards.

Looking at the prototype for pkg_hash_fetch_best_installation_candidate, it 
would make more sense for the constraint function to be a hard constraint. This 
is a fix I have already made in commit 
d94e3e14a0eb774c7601a8c3fd894143d165721b. However, this fix has broke 
pkg_hash_fetch_satisfied_dependencies as the wrong constraint function was used 
there.

Fixes to make:

- Use pkg_constraint_satisfied instead of 
pkg_installed_and_constraint_satisfied in pkg_hash_fetch_satisfied_dependencies.

- Remove the now duplicate checks after the calls to 
pkg_hash_fetch_best_installation_candidate in 
pkg_hash_fetch_unsatisfied_dependencies and 
pkg_hash_fetch_satisfied_dependencies.

- Fix the use of good_pkg_by_name in pkg_hash_fetch_best_installation_candidate 
as it now probably duplicates the use of latest_matching.

- Figure out if pkg_hash_fetch_best_installation_candidate_by_name needs fixing.

This is listed as Milestone-0.3 but it is a hard requirement for the v0.2.3 
release.

Original issue reported on code.google.com by paul.betafive on 19 Aug 2014 at 5:03

GoogleCodeExporter commented 8 years ago
I've fixed the first two points on this list on the opkg-0.2.x branch and 
merged forward to master. The other two still need work.

Original comment by paul.betafive on 20 Aug 2014 at 3:35

GoogleCodeExporter commented 8 years ago
I've now pushed fixes (to the opkg-0.2.x branch and merged them to master) for 
the last two points to the best of my understanding of what the original intent 
of the code is. This will get some further attention after the 0.3 release when 
the pkg_hash_fetch_best_candidate function is refactored.

Original comment by paul.betafive on 24 Aug 2014 at 12:36