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

opam list: unexpected interaction between --latests-only and --depends-on #6387

Open
kit-ty-kate opened this issue Feb 14, 2025 · 2 comments
Milestone

Comments

@kit-ty-kate
Copy link
Member

The new --latests-only parameter added in #5375 plays in unexpected ways with "package selectors" such as --depends-on or --required-by.

Given "package selectors" and "state selectors" are separate, they have a fixed order. Currently "package selectors" are ran first then "state selectors" are applied. However i would argue that the distinction is not well defined and should be revised before the release of 2.4 to make sure we don't break the behaviour of the new parameter.

Example

opam list --latests-only --depends-on base --all-versions --short pcre returns pcre.7.4.4 despite pcre.8.0.2 being the latest version and the position of the --latest-only parameter doesn't matter.
I would argue that the expected behaviour of such a set of parameter is to instead first filter the latest packages then to see which packages in these depend on base

@kit-ty-kate kit-ty-kate added this to the 2.4.0~alpha1 milestone Feb 14, 2025
@kit-ty-kate
Copy link
Member Author

Notes from dev meeting: we agreed on merging the two types of selectors (though we should keep the set-order behaviour when OPAMCLI < 2.4), and change the list of parameters given by OpamArg.package_selection by passing a new ~admin parameter for whether or not it is meant to be used with opam list or opam admin list

@rjbou
Copy link
Collaborator

rjbou commented Feb 19, 2025

The reasoning that is that some parameters are CLI position sensitive (OpamCommand.list'state_selector) while others precedence is hardcoded (OpamArg.package_selection). It is better to harmonise both and have them all CLI position sensitive to give more ways to the user to query with opam list.
There is no emergency on having it in 2.4 as --latests-only has been introduced in 2.3, but it would be a good to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants