Poc/develop2 exported lockfiles#10261
Conversation
|
Just found this, I'm wondering if lockfiles will be "embedded" inside a Conan package? I remember talking with you about that topic a while ago, one of the main drawbacks of lockfiles being that users have to store them somewhere and manage them (through version control, cloud, whatever). Is this it? :D :D |
Yes, this is an attempt, but a very different one of what has been discussed:
All of this is a very preliminar idea, maybe it won't move forward. But in any case, lockfiles in 2.0 are way simpler, so it will be an order of magnitude easier to manage them. |
|
This sounds awesome, looking forward to it! |
Hi @memsharded one question about this: we have conan recipes which determine dependencies depending on settings/options, so a lockfile 2.0 style only covering versions and revisions would still somehow indirectly "include" settings and options. How would you handle such cases? Would the lockfile contain the superset (is it even possible to determine since wild user-specific python code can be involved?) |
The idea is that profile management keeps identical with and without lockfiles. We have decoupled both things, it was being a bit confusing. So for a |
|
Hi @memsharded , thanks, so just to be sure I got it right: in the situation I describe above, where dependencies vary depending on settings or options, I would then need to keep separate lockfiles for each variant and also the corresponding profiles to be able to rebuild? |
No, it won't be needed. Just one single lockfile will be able to store and lock the different versions for the different configurations, even if there are conditional dependencies. So you can end with |
|
This would be an extremely helpful feature, is there any release date set for this? |
|
I am afraid not yet, this is a very early stage proof of concept, and there are still many unknown and high risks in this poc, so not anytime soon, there are other much higher priorities at the moment. |
|
I have updated this PR with the latest If there is interest in moving this forward, it would be extremely useful to battle-test this a bit more, get feedback and rough edges. If you could test it running from source from my branch, that would be amazing. The functionality UI/UX should be relatively simple:
Feedback very welcome! |
|
Hi @memsharded! I would really need this feature in my project, and I have a question with regards to the storing location of the conan.lock in anticipation that this PR gets released. Because the package_metadata_folder is still experimental for now, would it be ok if I store the conan.lock directly in the export folder? Should I expect some strange side effects with the current conan version (i.e. 2.20) behavior? Thank you! |
|
Yes, it is not possible to store the lockfile in the export folder in the general case:
This is why the lockfiles will go to metadata folders. |
| abs_path = os.path.join(root, f) | ||
| relpath = os.path.relpath(abs_path, folder) | ||
| if metadata: | ||
| if metadata and not relpath.startswith("conan"): |
There was a problem hiding this comment.
this is to ignore the lock?
|
Hello, With respect to how it could work, I would recommend having a look at cargo install --locked (which is common use in the rust world).
EDIT: "Yes, it is not possible to store the lockfile in the export folder in the general case:", "Lockfiles need to lock different configurations, for different binaries that have different requirements" -> so one lockfile per binary? |
This is a simple POC, that lockfiles can be exported together with a recipe, and if they are found while expanding the dependency graph, they can be used, locking the deps. This is something similar to the
https://docs.npmjs.com/cli/v8/commands/npm-shrinkwrapshrinkwrap concept, but in this case I am proposing a "merge" instead of an independent graph, as dependencies in C++ cannot be isolated in the same way.It is likely that activation/deactivation of this feature will be necessary, also probably appending lockfiles instead of merge strategy (the merge re-order by version or revision time) to maintain priority of downstream lockfiles.
Close #6851