override requirements in conan install

See original GitHub issue

In the docs you explain requirement overriding. I guess that can be used to handle diamond dependency conflicts. You force existing packages to use different versions of their requirements.

But what if a library needs to be rebuilt to correctly use different versions of its requirements? We would need to create different packages of that library. We can handle that by adding an option and using conditional requirements in the conanfile. Wouldn’t it be nice to be able to override the requirements the same way you override options and settings in the conan install command? Someting like:

conan install . --requires="LibA/0.1@demo/testing"

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:33 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
liesercommented, Jul 12, 2021

I would say that overriding without validating fits our use case better. We would e.g. like to overwrite a version of dep/1.0.0@user/stable or dep/[^1.0.0]@user/stable with dep/1.1.0@user/stable or dep/master@user/testing.

2reactions
memshardedcommented, Jul 19, 2021

Yes, the override is hard, as long as the package name is the same, the rest of the reference will be overriden.

For transitive dependencies, A depends on B and C and B depends on C, if C is overrrided, when B is rebuilt it needs to take the overridden C as well.

It also applies to transitive dependencies, yes, once a version is overriden it is overriden for the graph, not only for the declaring override consumer.

Also, the export triggers the “requirement” hook that I use to simulate this override, so we need to carry the wanted override as well.

Not sure what is the requirement hook (https://docs.conan.io/en/latest/reference/hooks.html#hooks-reference), so can’t say about this.

basically after a Conan install with override, whatever happen, whatever range protection, we need to use the overridden lib in every case.

Yes, this is the behavior 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing dependencies — conan 1.45.0 documentation
You can specify multiple requirements and override transitive “require's requirements”. In our example, Conan installed the Poco package and all its ...
Read more >
Overriding profile settings in Conan - Stack Overflow
Conan install a package based on your profile, thus, it doesn't matter if you are on Windows or Linux. You can override your...
Read more >
CONAN CHEAT SHEET - JFrog
conan config install <url>. Change a single config value ... Install requirements and generate files. $ mkdir build && cd build. $ conan...
Read more >
Installing Conan dependencies | Software Architecture with C++
By default, Conan wants to download all the dependencies as prebuilt binaries. If the server doesn't have them prebuilt, Conan will build them...
Read more >
Conan packages in the Package Registry - GitLab Docs
To publish Conan packages to the Package Registry, add the Package ... At the root of your project, create a build directory and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found