Skip to content
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

conan install context #15199

Closed
1 task done
jsallay opened this issue Nov 30, 2023 · 3 comments
Closed
1 task done

conan install context #15199

jsallay opened this issue Nov 30, 2023 · 3 comments
Assignees

Comments

@jsallay
Copy link
Contributor

jsallay commented Nov 30, 2023

What is your suggestion?

I have a use case where it would be nice to have a conan install --requires package/version work more like a conan install conanfile.py. I would like to be able to install a package and its build dependencies using the --requires option. (Maybe conan install --requires package/version --context=build)

I'm working to produce an offline environment for people to work with conan packages. I've created a custom command that lets a user install a package and its dependencies to a folder. They can then clone whatever repos they want to work in and run without having to worry about conan.

It is working fairly well, but I'm running into an issue with how the conan install command works. If I run conan install conanfile.py, it installs the packages needed to BUILD the conanfile. If I run conan install --requires package/version, this installs the packages needed to RUN the package. For example, this won't install any header-only dependencies. It would be really helpful if there was an option to install the build dependencies too.

Note that I am aware of editable packages, but I wasn't able to get it work out.

My present workaround is to do a conan install followed by a conan cache path to get the recipe location, followed by a conan install on the recipe. It's fairly clunky.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded
Copy link
Member

memsharded commented Dec 1, 2023

Hi @jsallay

Thanks for your feedback.

I think I understand the issue, but it is also true that the way Conan handles conan install --requires=xxx can make something like this a bit challenging.

A couple of quick questions:

  • Is your conanfile.py for that package mostly empty, and used just as a named way to be able to install the dependencies (and tool_requires)?
  • If that is the case, why isn't the flow git clone + conan install working? It seems less clunky.

The challenges can be:

  • If a package is already built and the binary exists, then its tool_requires are actually not downloaded at all, just the recipes, but the binaries are skipped
  • If the package is not built and the binary doesn't exist, the tool_requires will be downloaded to build it, but they are in practice private to the package, and not propagated to the consumers of the package, so they cannot be collected.

If the recipe is mostly a named proxy to install dependencies, I think with build_policy="missing" and using the new deploy() method feature that has been merged for 2.0.15 in #15172, it might be an approach to explore

@jsallay
Copy link
Contributor Author

jsallay commented Jan 25, 2024

I discovered that I can handle this by adding -c tools.graph:skip_binaries=False. It is not exactly the same as running conan install on the conanfile, but it is close enough and gives me what I need.

@jsallay jsallay closed this as completed Jan 25, 2024
@memsharded
Copy link
Member

I discovered that I can handle this by adding -c tools.graph:skip_binaries=False. It is not exactly the same as running conan install on the conanfile, but it is close enough and gives me what I need.

Good to know. It seems that I didn't fully understand the issue, but if that is working for you, happy about it 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants