openSUSE / libsolv

Library for solving packages and reading repositories
http://en.opensuse.org/openSUSE:Libzypp_satsolver
Other
517 stars 152 forks source link

"short-circuit" evaluation of boolean dependencies #570

Open voxik opened 3 months ago

voxik commented 3 months ago

I am coming here from https://bugzilla.redhat.com/show_bug.cgi?id=2295752. The issue is that given Requires: (weston or cage or kwin-wayland or mutter or gnome-kiosk), it would be natural (due to to commonly used "short-circuit" evaluation in programing languages) to assume weston is the preferred choice, but in reality cage is installed. I think this should change.

mlschroe commented 3 months ago

There's no easy way to implement this due to libsolv being a SAT solver that translates dependencies to rules on packages. With this translation all ordering information is gone. So the implementation would need to map the rule back to the originating dependency/dependencies.

I'm not sure if it's such a good idea, though, as it implies that there is always a preferred choice.

voxik commented 3 months ago

There's no easy way to implement this due to libsolv being a SAT solver that translates dependencies to rules on packages. With this translation all ordering information is gone. So the implementation would need to map the rule back to the originating dependency/dependencies.

If libsolv can leverage Suggests as a hint, this in my naive view is not really different.

I'm not sure if it's such a good idea, though, as it implies that there is always a preferred choice.

Why there should not be?

In my specific example, I really cannot judge why cage should be preferred. There likely is some metric baked into the solver, but that is not user transparent. Is that dependency chain length? But why that should be preferable to download size?

Looking into Fedora, there are 56 packages using the boolean syntax. From these 56, there are 8 which combines this with Sugests and one which is question, being reason for this RFE. And I doubt the Suggest hint is widely known.

voxik commented 3 months ago

And I doubt the Suggest hint is widely known.

Not mentioning that hinting the preferred package is not the original purpose of Suggests. It certainly is not capture in RPM documentation.