-
Notifications
You must be signed in to change notification settings - Fork 994
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] How to properly "evolve" lockfiles? #16819
Comments
I also tried with |
Hi @ericriff Thanks for your question. In general, yes, this is expected and as designed. I think you might be interested in #16811 and specially in #16811 (comment) The key is that if you want to update a lockfile, it is because there is another thing you want to test. If there is another thing to test, you surely already know its full reference, so you can use it in Please let me know if this helps. |
So the way I'm thinking about Conan lockfiles is: we maintain a conanfile with version ranges and we lock the dep tree using the lockfile. Once our project is mature enough, the conanfile will rarely change and most conan changes will only impact the lockfile.
So changes there are not just for testing. I see the lockfile as the source of true for the actual packages we will be using. The thing is
What's not clear to me is why the conan lock cmds are ok with producing incomplete lockfiles. It seems error prone to me.
Would it be possible to include some sort of stricter behavior on the |
Agree with this, lockfile is a source of true for reproducing dependencies.
It does modify the lockfile contents, but it does an important operation: it sorts the versions and revisions in chronological order. This sorting is critical for the correct functioning of lockfiles, and this is why it is discouraged to modify the lockfile manually, as it would easily result in inconsistencies.
Because there will be very different users with very different needs. Evolving a lockfile with incomplete information, having partial lockfiles, etc is possible. As a note about comparing with other technologies lockfiles: how many other lockfiles allow to lock different versions or even different revisions of the same package in the same lockfile? This is completely unexpected and unsupported in many technologies but some C++ users need to express dependency graphs with different versions of their dependencies.
To be able to implement this, it would be necessary to add the full suite of arguments ( The thing is that this wouldn't be necessary in most cases. I think that users shouldn't be doing Regarding the "extra" necessary What are the user stories? Story 1: A user is creating a new version/revision of some dependency, and then they want to test their app with the new thing. No need to do |
I was reading at this and I must say, I'm surprised Conan supports this. I think it is confusing. With other tools when people ask me, which version do we use here for this? I say just look at the lockfile. With conan2 there could be more than one entry for the same dependency. Unless I find some really nit thing about these lockfiles with multiple versions of the same package, I think I'll personally continue using the v1 style with different locks for different configs. Maybe I just "don't see it" just yet. Lockfiles are a hairy topic.
If it is a pain to implement, that's ok. BTW I'm just trying to find a good, straightforward to the question "Hey, how do I bump / downgrade the version of libX". As an example it says
One more thing, could you please elaborate a bit more on this?
I don't understand the part about conan create with lockfile in-and-out to update a given package. Thanks. |
It is not different configs having different versions. The same dependency graph can depend on different versions of the same package. This is not a Conan 2 new supported case, this was already supported in Conan 1 and it was the reason that lockfiles were way more complex in Conan 1, because they had to represent the full graph in the lockfile too, and Conan 1 lockfiles could also have more than 1 different version of the same package in the same lockfile. It is not confusing, it is a real world scenario that Conan must support, as users need it. We of course prefer and recommend to only have 1 version of the same package in the dependency graph, but there are users that simply cannot do it because they have other constraints. As a recent example, we introduced the capacity of
This is the example in #16811 (comment) Using something like
No need for a explicit |
Hi, just came across this issue as I'm also working with lockfiles and have one particular question which is also in the first post from @ericriff. Hope its fine to add it here: The initial lockfile contains timestamps as shown in the examples above (everything after the |
I still don't get it. Is there a place where I can read about lockfiles with multiple versions of the same package? I didn't find anything on the docs. Furthermore, I'm not sure what self.requires('lib_a/[<=2.3 < 2.5]') My lockfile would look something like
Why will that conan create cmd compute a different lockfile than the one you passed with If my conanfile looks like this def requirements(self):
self.requires('boost/[>=1.84 <2.0]', transitive_headers=True)
self.requires('zstd/[>=1.4 <1.5.6]')
self.requires('eigen/[>=3.3.9 <4]', transitive_headers=True)
self.requires('protobuf/[>=5.27 <6]')
self.requires('lib_a/[<=2.3 < 2.5]') How do I make it update only lib_a? Does your conan cmd assumes the rest of the packages on the lockfile were already pointing to latest? |
It is true that the if existing and existing.revision is not None:
raise ConanException(f"Cannot add {ref} to lockfile, already exists")`` The full revision with timestamp can be displayed for example with the |
I was seeing this, too, but was able to resolve it by doing a |
Is there any shortcoming if I don't add the timestamp, just the version and rref of the project? I'm only using one entry per project in my lockfile if that is important. Not e.g. multiple versions of the same as described above. Is there a special reason why I need to use
|
In the docs https://docs.conan.io/2/tutorial/versioning/lockfiles.html#evolving-lockfiles, the code is already showing how a lockfile can represent more than 1 version for the same package. But this is not something exclusive from the lockfile, it is a property of the dependency graph. Consider this:
The created
Full case:
Now someone creates a new liba/1.1, with the intention to integrate it in app1.0.
Note the 2 versions of liba in the same lockfile.
It is important how the 2 different versions of liba in the same lockfile play their role:
This is the approach that can produce fully deterministic parallel builds for concurrent changes to |
What is your question?
Hi All
I recently started looking into conan2 lockfiles and I'm not sure one is supposed to evolve them over time.
particularly
I have a dummy project where I just have a bunch of requirements using version ranges.
When I lock the project with
conan lock create .
I get a "complete" lockfile where every package is fully locked (I get a version, a recipe revision and two more numbers%xxxx.yyy
which I'm not sure what they mean).So far so good. But lets say that I want update just
zlib
, the docs say I should doconan lock add --requires zlib/1.3.1
But this produces an "incomplete" lockfile,
zlib
doesn't have a RREV nor the other two numbers after the%
.And in order to complete it I need to
conan install . --lockfile-out=conan.lock --lockfile-clean
Which takes me back to a sane lock
Why is this extra step needed?
Furthermore this only works to update dependencies. If I repeat these steps to use an older zlib, it doesn't work:
produces
But when i do conan install to complete the lockfile (
conan install . --lockfile-out=conan.lock --lockfile-clean
) I get 1.3.1 againSimilarly, I tried to remove boost from my project so I took it out of my
conanfile.py
and ranconan lock remove --requires boost/1.85.0
To my surprise all of boost dependencies were left behind on the lockfile. They did got cleaned up after
conan install . --lockfile-out=conan.lock --lockfile-clean
Am I doing something wrong? Or this is the expected workflow? (each conan lock operation should be followed by a conan install --lockfile-out=conan.lock --lockfile-clean)
I'm used to working with
poetry
lockfiles, so my brain might be wired to do something else. I think that poetry's lockfile management is exceptional. Just in case you're not familiar, these are some example cmds:I think they way poetry does it is very intuitive. Maybe it doens't work on the c++ world.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: