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

[question] how to deploy without dependencies #16295

Open
1 task done
pwqbot opened this issue May 17, 2024 · 3 comments
Open
1 task done

[question] how to deploy without dependencies #16295

pwqbot opened this issue May 17, 2024 · 3 comments
Assignees

Comments

@pwqbot
Copy link

pwqbot commented May 17, 2024

What is your question?

Currently, I use conan install --requires="my_package" --deployer="my_deployer" to deploy my binary. However, this command pulls all dependencies also, but I only need my package binary. Is there a way to avoid pulling other dependencies?

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this May 17, 2024
@memsharded
Copy link
Member

Hi @pwqbot

Thanks for your question.

You have the direct_deploy that only deploys the direct reference, not the dependencies.

But I guess you don't mean that, but the fact that Conan is resolving the dependency graph. It is indeed necessary to compute the dependency graph, because the binary that is pulled when you do conan install --requires="mypkg/version" also depends on the dependencies and transitive dependencies. For example if mypkg is an application, and the dependencies are static libraries, it might be necessary to re-build mypkg from source to get an update binary. Only computing the dependency graph allows to compute updated package_ids and making sure the thing that is being deployed is what is expected.

Conan has the "skip" binaries mechanism, so if things are updated and all is looking good, Conan will mark most of the binaries as "skip" and avoid pulling the dependencies if they are not necessary (like all static libraries will be skipped), making the process efficient.

If all you want is access to the artifacts for a given pkg/version:package_id, then you can do conan download + conan cache path for that specific package-id, and copy the files from the package. If you want to do something more advanced (without modifying the cache, that is not allowed), then you might want to wrap that in a custom command instead of trying a deployer, and your custom command can download the specific package-id and do what you want. But that is a different approach than the deployers that are designed to do operations on a dependency graph, not on one package.

@pwqbot
Copy link
Author

pwqbot commented May 20, 2024

Hi @pwqbot

Thanks for your question.

You have the direct_deploy that only deploys the direct reference, not the dependencies.

But I guess you don't mean that, but the fact that Conan is resolving the dependency graph. It is indeed necessary to compute the dependency graph, because the binary that is pulled when you do conan install --requires="mypkg/version" also depends on the dependencies and transitive dependencies. For example if mypkg is an application, and the dependencies are static libraries, it might be necessary to re-build mypkg from source to get an update binary. Only computing the dependency graph allows to compute updated package_ids and making sure the thing that is being deployed is what is expected.

Conan has the "skip" binaries mechanism, so if things are updated and all is looking good, Conan will mark most of the binaries as "skip" and avoid pulling the dependencies if they are not necessary (like all static libraries will be skipped), making the process efficient.

If all you want is access to the artifacts for a given pkg/version:package_id, then you can do conan download + conan cache path for that specific package-id, and copy the files from the package. If you want to do something more advanced (without modifying the cache, that is not allowed), then you might want to wrap that in a custom command instead of trying a deployer, and your custom command can download the specific package-id and do what you want. But that is a different approach than the deployers that are designed to do operations on a dependency graph, not on one package.

Thanks! I think download + cache path may work. How to query for package id with params like package/version -s build_type=Debug -pr x86_linux_gcc_13_Debug -pr:b x86_linux_gcc_13_Debug?

@memsharded
Copy link
Member

Thanks! I think download + cache path may work. How to query for package id with params like package/version -s build_type=Debug -pr x86_linux_gcc_13_Debug -pr:b x86_linux_gcc_13_Debug?

With conan graph info ... passing those arguments. Note that this will compute the dependency graph, as commented above the package_id is also a function of the dependencies versions and revisions, so it is necessary to compute the graph, even if the binaries for the dependencies are not downloaded.

Alternatively, the conan list command has the --filter-profile and --filter-settings that can help listing the packages that matches some profiles and settings, but not this is just a filter of the existing binaries that matches those conditions, not an update package_id computation.

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