Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Add way for solver to iterate over versions oldest first #1003

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jrray
Copy link
Collaborator

@jrray jrray commented Mar 9, 2024

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:

  • 1.2.1.2/BUILDA x.x.a.b
  • 1.2.1.1/BUILDA x.a.b
  • 1.2.1.1/BUILDB x.x.a.b
  • 1.2.1/BUILDA x.a.b
  • 1.2.0.1/BUILDA x.a.b
  • 1.2.0/BUILDA x.a.b
  • 1.1.0/BUILDA x.a.b

The ideal iteration order might use an algorithm like this:

  1. Pick a build from the newest version and find all the versions/builds compatible with it, then iterate on those in oldest-first order.
  2. Repeat step 1 skipping anything already visited.

That would produce the following order for the above example:

  • 1.2.1.1/BUILDB x.x.a.b -- group 1
  • 1.2.1.2/BUILDA x.x.a.b -- group 1
  • 1.2.0/BUILDA x.a.b -- group 2
  • 1.2.0.1/BUILDA x.a.b -- group 2
  • 1.2.1/BUILDA x.a.b -- group 2
  • 1.2.1.1/BUILDA x.a.b -- group 2
  • 1.1.0/BUILDA x.a.b -- group 3

They are grouped by matching compat values, and the version(s) that are all considered equal with each other following that compat 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.

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:

- 1.2.1.2/BUILDA x.x.a.b
- 1.2.1.1/BUILDA x.a.b
- 1.2.1.1/BUILDB x.x.a.b
- 1.2.1/BUILDA x.a.b
- 1.2.0.1/BUILDA x.a.b
- 1.2.0/BUILDA x.a.b
- 1.1.0/BUILDA x.a.b

The ideal iteration order might use an algorithm like this:

1. Pick a build from the newest version and find all the versions/builds
compatible with it, then iterate on those in oldest-first order.
2. Repeat step 1 skipping anything already visited.

That would produce the following order for the above example:

- 1.2.1.1/BUILDB x.x.a.b -- group 1
- 1.2.1.2/BUILDA x.x.a.b -- group 1
- 1.2.0/BUILDA x.a.b -- group 2
- 1.2.0.1/BUILDA x.a.b -- group 2
- 1.2.1/BUILDA x.a.b -- group 2
- 1.2.1.1/BUILDA x.a.b -- group 2
- 1.1.0/BUILDA x.a.b -- group 3

They are grouped by matching `compat` values, and the version(s) that
are all considered equal with each other following that `compat` 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.

Signed-off-by: J Robert Ray <jrray@jrray.org>
@jrray jrray self-assigned this Mar 9, 2024
@jrray jrray added the agenda item Items to be brought up at the next dev meeting label Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agenda item Items to be brought up at the next dev meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant