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

[question] alternative solution to Conan 1 alias? #16702

Closed
1 task done
harsszegi opened this issue Jul 19, 2024 · 4 comments
Closed
1 task done

[question] alternative solution to Conan 1 alias? #16702

harsszegi opened this issue Jul 19, 2024 · 4 comments
Assignees

Comments

@harsszegi
Copy link

harsszegi commented Jul 19, 2024

Hi,

we were using Conan 1 alias feature to overcome the fact that our versioning scheme is not 100% semver compliant. We have hacked this around via creating aliases with proper semver format to the original non-fully-semver-compliant version.

Is there any other solution to do something similar in Conan 2 (as alias is gone)?
Thanks,

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Jul 19, 2024
@memsharded
Copy link
Member

Hi @harsszegi

alias is not fully gone, it is still in the code, although not documented, to try to help some extreme migrations cases. So the alias syntax is there in Conan 2, just with the modern explicit (alias) with parenthesis (https://docs.conan.io/1/versioning/introduction.html#package-alias)

Still, it would be good to know about the versioning scheme, Conan 2 version ranges are more powerful than in Conan 1, there might be some other possible alternatives than using alias.

@harsszegi
Copy link
Author

harsszegi commented Jul 19, 2024

Well, it is something like this:

package_name/3.0.5+feature_conan2+558-d0d0582-dirty@user/dev

feature_conan2 is the name of the Git branch, sanitized (feature/conan2)
+558 is a Git count somewhat showing the distance from HEAD (git rev-list HEAD --count)
-d0d0582 is the short Git hash
-dirty is an optional if the repo is not clear

[btw I get this for "conan alias"

(conan2) D:\workspace\virtualenv\conan2\Scripts>conan alias
'alias' is not a Conan command. See 'conan --help'.

ERROR: Unknown command 'alias'
]

@memsharded
Copy link
Member

package_name/3.0.5+feature_conan2+558-d0d0582-dirty@user/dev

Ok, to make it more compliant, it seems that things should be made part of pre-releases like:

3.0.5-pre.558.feature_conan.commit

With fields that have a natural resolution order first. Opt-in to resolve to pre-releases can be done in Conan 2 with a conf that enables and disables pre-releases.

Still, the version resolution logic under different version-ranges would not be well defined, as fields as the branch name or the commit are not naturally ordered, and that breaks versioning approaches.

One "devops" good practice is to use different server repositories to model certain stages of the SW, but not including the stages or things like the "branch" in the version name, as this will not allow to have package immutability. We are documenting this in conan-io/docs#3799

btw I get this for "conan alias"

In Conan 2 it is not a command, but a conan new alias ... template, followed by the conan export command.

@harsszegi
Copy link
Author

Awesome, thanks a lot @memsharded, closing it!

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

No branches or pull requests

2 participants