conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.25k stars 980 forks source link

[bug] `conan list` filtering option asks users to use scope patterns when those don't work in that context #16545

Closed AbrilRBS closed 4 months ago

AbrilRBS commented 4 months ago

Describe the bug

When running conan install with the --filter-options argument, you're supposed not to scope the option. But if you do so, you get a warning like

WARN: legacy: Unscoped option definition is ambiguous.
Use '&:shared=True' to refer to the current package.
Use '*:shared=True' or other pattern if the intent was to apply to dependencies

which disappears if you use a scope, but then the filter does not work properly

How to reproduce it

No response

AbrilRBS commented 4 months ago

I might have missremembered and you're actually supposed to scope it with *:. Still, the point stands than then it's not intuitive and we should check if we can do something about it

memsharded commented 4 months ago

The only test that applies is c.run(f"list *:* -fs os=Windows -fo *:shared=False --format=json {r}"), so I am not sure if the intent is not to scope options. Actually, the warnings were added with the intention to always scope options everywhere, including profiles, and also in the --filter-options. The idea is that the filter will be what you would put in a profile, and get the same warning as if you use it in a profile.

The test doing it seems to work: https://github.com/conan-io/conan/blob/88d03589084167471262d004a183fea39985a616/test/integration/command_v2/list_test.py#L891, with the scope.