Skip to content

[question] Workflow to update single dependencies in a lockfile #16377

@fschoenm

Description

@fschoenm

What is your question?

Hi, I have a question regarding lockfiles that is not yet clear to me and I haven't really found the answer so far.

This is based on a real-world use case:

  • We have a product (conan consumer) with a handful of dependencies, one of them being boost. It's using and compatible with boost/1.82.0, which is on our remote, but introducting boost/1.85.0 leads to a compile error.
  • We want to have a conan.lock to lock the dependencies so that uploading boost/1.85.0 to our remote doesn't break the build.
  • After fixing the compile issues with boost/1.85.0, we want to update this specific dependency to the latest version allowed by the version range but keep all other dependencies at the version they are.

What's the recommended workflow for this? It doesn't seem possible out of the box?

  • In [bug] conan lock create --update doesn't appear to work #16267 (comment), I found the recommendation to use conan .... --update --lockfile="" --lockfile-out="conan.lock but that would update all dependencies to the latest version. Using conan .... --update boost* --lockfile="" --lockfile-out="conan.lock would limit that somehow but IMO still update all dependencies found in the local cache.

  • Using conan lock add --requires boost/1.85.0 does kind of work but now the lockfile contains both the old boost version (including the revision) and the new boost version (but without a revision). What does it mean that the old version is still in the lockfile and why isn't it replaced? Also, I'd like to let conan resolve the valid version range instead of manually specifying the version (and revision) of a package.

  • One workflow that seems to do what I want but seems overly complicated for an IMO common use case is this:

    $ conan lock remove --requires boost/*
    $ conan install ... --lockfile-partial --lockfile-out conan.lock
    

    I think it did what I wanted but I'm not sure because I couldn't find this workflow in the documentation. If this is the correct workflow, I also wonder if it would be possible to simplify it into a command that specifically updates a single dependency by resolving the valid version range?

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions