Given packages a and b with versions 1,2,3 (higher is more preferred), and a dependency A|B
giving preference to A,
how would you expect a dependency a|b to expand?
- A over B within each preference level:
a (= 3) | b (= 3) | a (= 2) | b (= 2) | a (= 1) | b (= 1)
- any A over any B:
a (= 3) | a (= 2) | a (= 1) | b (= 3) | b (= 2) | b (= 1)
- candidates first, any non-candidate A over non-candidate B
a (= 3) | b (= 3) | a (= 2) | a (= 1) | b (= 2) | b (= 1)
In terms of optimization criteria, options 1 and 2 can be composed from easier criteria, namely
one criterium version-preference
that makes the solver prefer some versions more than others
and a criterium ordering
that makes it prefer A
s over B
s:
option 1 first optimizes version-preference
then ordering
, whereas option 2 reverses that.
In contrast, option 3 is not composable from those criteria.
Considering which option is the best is hard, and there might not be a universal answer. One criterium to evaluate the default behavior could be how discoverable non-standard choices are to the user.
Let's look at aptitude. aptitude already allows non-optimal solutions, and when it picks a non-candidate version, it will warn you about that. From that perspective, option 1 and 3 yield the worst discoverability: If a (= 3)
is not satisfiable it would fall back to b (= 3)
and not generate any messaging. Option 2 is close to optimal in that regard: We'll try all choices of a
that cause a message before trying the silent b (= 3)
one.