-
Notifications
You must be signed in to change notification settings - Fork 993
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
[feature] ability to update a reference to an earlier version in a conan lockfile #14523
Comments
A related issue is that without In our specific case, the issue is that we build test packages with a "test" user, and we want to trigger CI-pipelines for other upstream packages. We used to be able to do this in a very simple way:
Even if the version range in
Now, even if I override the lock file to include the specific version of the test package, I get:
because the user is So we went from a situation where overriding versions was convenient and simple to nearly impossible. Do I have to go back to using EDIT: While I think it (obviously) makes sense to adhere to version ranges in the general case, it's incredibly convenient and useful to be given the option to say "use this package, no matter what the version ranges are". |
There is underlying thing there, which is the practice of using channels as a variable controlling the flow and usage of packages. Conan 2.0 also proposes other mechanisms to achieve this, for example, in order to test "test", the right approach would be to use semver pre-releases, and activate it with the This is way more conforming to standard versioning practices and it is the recommended way moving forward. |
Hi @memsharded, Thank you for your response. Indeed, we are now experimenting with using a different method than "user" to differentiate between test packages and release packages (I did not use channels). We will now try using semantic versioning instead. However, I think my point still stands. It is extremely useful to be able to easily force behavior when necessary. The default behavior should be to conform to the version ranges, but if a user wants to test something (perhaps even test it locally on their machine), it should also be easy for them to force their entire build graph to use a certain version (with
I agree correct versioning use should be encouraged. However, hacky use should be allowed when requested, and perhaps a warning could be emitted rather than a failure. I cannot stress enough how important it is to reduce the mental overhead during development. Conan is not an easy tool to use, even for me who's been actively using it for years. Now imagine how it is for my team members who are novices. Now that I have written my own script to do require-override in the lockfile, and have set appropriate version ranges, it works as intended (by the way, I was very impressed that now I can override a dependency of a dependency without having to rebuild the direct dependency. This is a major step forward for Conan 2). But it would've been really awesome if I didn't have to write this script myself. |
But this is easy and straightforward. If a developer wants to test a certain thing in their machine, the only thing they need to do is to build/create/export what they want to their local cache, with the same name and version (or compatible version in the range). Conan graph resolution will be using their own cache package automatically. No need to override, not need to use lockfiles, or change anything anywhere. They can also use
We agree with this, and it has been one of the main reasons to move in this direction in Conan 2.0. The use of variable
Thanks, I am very happy that you appreciate some of the improvements that Conan 2.0 brings. We strongly believe that 2.0 is a much better, order of magnitude, Conan version, with tons of improvements over the graph, lockfiles, UX, command line, extensibility, etc. And we also know that it can be frustrating when something that used to work in the past is removed, and we have considered those removals quite thoroughly, and in this case we were sure that the conclusion of dropping the flows that use
Sure, so far this feature is looking good, and we will add commands to do this task automatically. Thanks for all the feedback! |
Hmmm, I will try to look into this more closely, we haven't been very good at using editable so far, even though that is my most favoured option (it requires some setup, and I suspect we will have to do some restructuring of some packages). With regards to using the local cache, I will try to understand better how packages are chosen, and my impression is that this could be easier in Conan 2 than 1. In 1, my impression was that it wasn't very simple. One thing I found painful when using editable in the past (Conan 1) is that the version range of the editable package was still taken into account. If a package exists in some repo which is of a higher version it may be chosen instead of the editable package. In my mind, if I say "use this package as editable" Conan should just do it, and not worry about the version of the package (or at the very least there should be a Speaking of However, I ran into a little snag, which may be relevant to this ticket. With our current flow, we use a script to overwrite the version of a dependency in the lockfile, to test pre-releases. For example: The issue I ran into was that our range was: Perhaps the feature from this ticket would resolve this case anyway? |
With the correct
Conan 2.0.10 has gotten resolution of version ranges taking into account the In practice this should be a big inconvenience, if you want to force it, you could either remove the newer versions from the Conan cache, or bump the In any case adding #14510 was a missing piece, very necessary for resolving version ranges for editables, please update to 2.0.10, feedback welcome.
I am afraid this sound quite breaking, and will most likely cause lots of confusion and issues to other Conan users. The
|
Hi @memsharded, I have now been thinking about this for several weeks, and have been taking your feedback into account. In some cases I agree with you, and we've been able to work through several of the issues we've had. However, I seem to keep running into new issues when it comes to versioning. I'm sorry that this post is very long, but it's quite difficult to explain succinctly. With regards to issues we have already discussed:
Considering issue 4: We have a workflow where if package TOP depends on package DEP, the CI pipeline of package DEP will trigger a CI pipeline for TOP. This pipeline will override the lockfile of TOP to use the version of DEP under test. We wrote a little conan extension to do this override, which simply iterates through the TOP/conan.lock (we are now checking lockfiles into git) and replaces the line containing DEP/version_used_for_TOP with DEP/version_under_test. This works okay, and has been running for a few weeks. However, we have some concerns. Several concerns. Does this CI flow make sense?We have been using this pipeline triggering flow for years, and it has been very laborious, and has caused many difficulties with Conan. Are we doing something wrong? Sometimes I get the feeling that nobody else is doing this since we have so many corner cases for which there are no pre-existing solutions. On the other hand, it's hard to understand how else we should be doing it. Transient dependenciesIf DEP has another dependency DEPDEP, and we try to override TOP/conan.lock, we end up only overriding the version of DEP and not the version of DEPDEP. Fixing this would require a complex solution which we believe should be beyond the scope of our little utility extension. However, being given no choice at the moment, we are in the process of writing an extension which does this. We suggest: Which would not add a second entry of DEP, but overwrite the entry which is in the existing lockfile, and also overwrite the version of DEPDEP with the version used to build DEP. Merging lockfiles with prioritiesCurrently, there doesn't seem to be any way at all to override the lockfile for TOP with the versions used to build DEP. We end up with multiple versions of the same packages (if we use lock merge or add). E.g:
Leads to something like:
In this case, I am really mostly interested in testing DEP. I'm testing that it still works with TOP, so that I will know ahead of time if there are breaking changes. The problem I have with the way things are now, is that I depend on So what I want, really, is:
We suggest: Which would, if there are dependencies which are listed both |
This has been implemented in #15284, with the following approach, using a The idea is that updates are equivalent to something like: $ conan remove --requires=zlib/* && conan add --requires=zlib/1.2.11 Please see description of #15284 for more info. |
What is your suggestion?
From: https://cpplang.slack.com/archives/C41CWV9HA/p1692362444235349
At the moment, it is possible to update a lockfile to a new version (and also update the revision), but with
conan lock add
it's not possible to add an earlier version in a meaningful way (it would not resolve to that one).Some options:
conan lock remove
+conan lock add
+conan lock create
conan lock update
(some challenges: lockfile may have different reversions/revisions of the same recipe, which one gets updated, consider a pattern)Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: