conan-io / conan

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

[bug] Conan 1 "conan profile show" ruins Conan 2 compatible package options #17269

Closed harsszegi closed 2 weeks ago

harsszegi commented 2 weeks ago

"conan profile show" ruins Conan 2 compatible package option delimiter

Environment details: Conan 1.65, Windows

Hi,

we are relying extensively on the "include" mechanisms of the profiles in Conan. However to make life easier for the users, we are "flattening" the profiles via "conan profile show", and these "flattened" profiles are published.

We are in a transition period from Conan 1 to Conan 2, so we started to "migrate" our profiles, e.g. we have replaced

foo:option=bar

to

foo/*:option=bar

However "conan profile show" replaces the "/*:" back to ":" so they are not "Conan2-compatible" anymore.

How to overcome this? Thanks,

How to reproduce it

Create any profile that has "/:" in it, then do a "conan profile show" in Conan 1.x and "/:" is lost

memsharded commented 2 weeks ago

Hi @harsszegi

Thanks for your report.

I am not sure about the flow. But if the profiles are intended to be common for both Conan 1 and Conan 2 (this is not the general case, as profiles can easily be different in Conan 1 and Conan 2, for example Conan 2 strongly requires compiler.cppstd, while this was not the case in Conan 1. Also, compiler="Visual Studio" is the mainstream in Conan 1 but in Conan 2 it will be compiler=msvc)

But if you intend to have the same, common profiles for Conan 1 and Conan2, maybe it is possible to run that "flattening" in Conan 2 only?

harsszegi commented 2 weeks ago

Hi @memsharded,

currently we are on full Conan 1 use still, meaning we are building and deploying Conan 1 packages. The profiles although are compatible with Conan 2, e.g. we are not yet using any "fancy" profile features that only Conan 2 supports.

Because of the heavy "include()" use in our profiles, for "not-that-skilled" developers we had to offer a solution, so that they can see the "final" / "flattened" profile, so that they can understand what options / settings are set for a certain profile "at the end of the day".

I'll try to reschedule this to Conan 2, closing this, thanks for the info!

memsharded commented 2 weeks ago

currently we are on full Conan 1 use still, meaning we are building and deploying Conan 1 packages. The profiles although are compatible with Conan 2, e.g. we are not yet using any "fancy" profile features that only Conan 2 supports.

Please note it is not just new features. But what I commented above, compiler.cppstd should be defined in Conan 2 for most cases, but this was not the case for Conan 1.

Because of the heavy "include()" use in our profiles, for "not-that-skilled" developers we had to offer a solution, so that they can see the "final" / "flattened" profile, so that they can understand what options / settings are set for a certain profile "at the end of the day".

Thanks, yes, I think I understand the use case.

I have doubled check if this was something achievable in Conan 1.X, but it doesn't seem the case, that /* is removed, so artificially adding it could be considered breaking by some users. As the conan profile show behavior and output is correct for Conan 1.X scope, it cannot be considered a bug and the risk of changing it would be too high.

Maybe you don't need to delay it, and some regex search and replace in the resulting profiles could be enough.