-
Notifications
You must be signed in to change notification settings - Fork 985
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 depend on a specific Git commit or branch of a project #16309
Comments
Hi @tttapa Thanks for your question. To use a specific commit of the original repo, it is necessary to include or add that commit in the recipe that creates the package. If you want to customize ConanCenter recipes to include later releases or other customizations that do not exist yet in ConanCenter (or might never be possible to be merged upstream), then you can easily have your own package, with the version you want, without conflicting with the existing ConanCenter ones. This is done by doing a fork of the
|
I see, thanks for the quick response, the local recipes index feature looks promising! If I understand correctly, this approach would require me to use the latest public Conan Center version in my project's conanfile, correct? I cannot set my custom version as the default requirement, otherwise users of my project will not be able to do the standard Do you know of any plans to add direct Git support to Conan? E.g. by directly specifying a URL to the custom recipe, such as |
No, you can use any version of ConanCenter, including older ones. The
Yes, this has been discussed many times, and it is not planned. There are many limitations, complexities and problems associated with this approach. Conan follows the model of Maven for Java, with a strong abstraction over the dependencies references and using dedicated package servers, not coupling them with hardcoded source locations in recipes. The "local-recipes-index" feature was introduced to allow modifications to recipes in a convenient way, but for the most part is intended as a package creation flow, not as a package consumption flow, that is, packages should be created from the fork and stored in some package server. |
Thanks, I meant that putting a Conan Center version (e.g. the latest, but could be any version) would be the only way to keep my project easily installable by users. IIUC, there are two options:
Is there any way to make the installation process simpler for users of my project (i.e. no need to manually download and set up other repositories first), while also selecting a custom version by default so they don't end up with a subtly broken build? |
It depends on who your users are. There are wildly different use cases, if those are other colleague developers in the same organization or company, or if you are planning to release something as open source library.
Yes, and they can also have other bugs when using a non-released version of eigen, because the maintainers didn't put the typical pre-release effort to stabilize and do more comprehensive tests. This is not an issue of the package manage per-se, but of the library and its maintainers. My experience suggests that if Eigen had very critical updates that haven't been released and the users wanted to use, we would already have an updated
That is the thing that depend on who your users are. For organizations, this is not an issue, because they basically get the configuration from a
And if your users are open-source users, is it really necessary that they use the very latest eigen from source? What actual crashes or issues happen if they don't? Maybe it is worth to consider a In any case, "significantly raises the barrier" means:
If it is that important to use customized versions that cannot exist in ConanCenter, then those are relatively straightforward setup instructions, specially for open-source users that are typically faced with much more complicated project setups. |
Thanks, I appreciate the advice. One more question on this topic: Would your recommendation be different for dependencies that I maintain myself (i.e. where I could do |
When using a package manager, the natural flow is enabling CI to build a new package version (or revision) for the commit or tag you want to make available for others to use. For first-party code, the recommendation would be to put the
The issue is that we haven't managed yet to write comprehensive CI docs, the plan is it that it will be added to https://docs.conan.io/2/devops.html section, but it is difficult to get the time. Conan 2 has some important features to be able to support CI at scale, like the The plan is to add this documentation in the following months. |
I am marking this to be closed by the new CI-Tutorial in the docs: conan-io/docs#3799 |
What is your question?
Hi,
Is there any way to depend on a specific commit or branch of a package on Conan Center? E.g. similar to what Python's Pip does: https://pip.pypa.io/en/stable/topics/vcs-support/:
MyProject @ git+https://git.example.com/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709
.Use case:
Some packages (like Eigen) may go years without releasing a new version. I cannot use the latest release, because it is too old and I need some bug fixes that were added in later commits to the
master
branch.What I'd like to be able to do is the following:
requires = "eigen/d165c7377f7d1f55f0209c5eab19972941b35c56/git"
(fictitious syntax) to request a specific commit (after the latest release) that is known to work, and includes the necessary patches.requires = "eigen/master/git"
so I can test the latest commit on themaster
branch of Eigen.requires = "eigen/3.4.0"
.Creating my own
"custom-eigen"
package is not an option, because then a user could end up with a build tree containing both the official"eigen"
package and my"custom-eigen"
package, which would conflict.Looking at the Conan documentation and the questions here on GitHub, I doubt this can be done exactly as described, but what are the alternatives? Which approach would you recommend for such a use case?
Thank you!
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: