RFC: Add way for solver to iterate over versions oldest first #1003
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is an idea for a "cheap" way (minimal code change) to let a recipe ask for the minimum version that is compatible rather than the newest version, to address the problems explained in #897.
This doesn't iterate in the exact order that would be desired, but it can acheive the desired results in practice.
The complication comes from the fact that different builds in the same version can have different
compat
rules, plus different versions of a package may have different numbers of version parts. The solver goes version-by-version and then build-by-build, limiting its iteration order flexibility.Given these builds and compat rules:
The ideal iteration order might use an algorithm like this:
That would produce the following order for the above example:
They are grouped by matching
compat
values, and the version(s) that are all considered equal with each other following thatcompat
rule.As you can see, assuming I applied the algorithm correctly, it would jump between versions as it steps over builds, not exhausting all builds of a single version before trying a different version.
This would be a substantial change to the solver and package iteration.
The naive approach in this PR would visit 1.1.0 first, when in the ideal order it would be visited last.