conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.95k stars 951 forks source link

Downloading and Install Single Conan Artifact in JFrog's Artifactory #16469

Closed jbisbee closed 5 days ago

jbisbee commented 2 weeks ago

What is your question?

We have a whole setup of complicated builds working and uploading to JFrog's Artifactory. The dependency resolution is great for building, but our binaries are statically built and we only need the single package to deploy. How do we grab a single package out of Artifactory to deploy locally. With all the internal hash resolution it seems near impossible to do manually (without using the conan client)

I've gotten this far and just need a bit of help to download and install a single package from Artifactory with these instructions:

Once this is done, how do I get the contents of: ~/.conan/p/[SHORT-PACKAGE-NAME]/p/[PACKAGE-NAME] deployed to a target directory without dependency resolution or breaking encapsulation into conan's cache?

Have you read the CONTRIBUTING guide?

memsharded commented 2 weeks ago

Hi @jbisbee

Thanks for your question.

When using conan download <pkg-reference> -r=remote, the key is that the pkg-reference can be an exact full reference, including the package-id, something like:

conan download mypkg/0.1#recipe_revision:package_id -r=myremote

This will download the package binary belonging to that specific package_id. From there, getting the path to the binary can be done using exactly the same reference:

conan cache path mypkg/0.1#recipe_revision:package_id

(tip: you can skip the recipe_revision to get the latest one and you can use the --format=json > mypath.json output for machine readable format) You can copy the artifacts directly from that path.

If the issue is that you don't know the package_id, but you know the input profiles, then the approach would be:

conan install --requires=mypkg/0.1#recipe_revision -pr=myprofile --deployer=direct_deploy --deployer-folder=myfolder

(tip: you can also skip the recipe_revision to get the latest one). This conan install will evaluate the graph to be able to compute the exactpackage_id(as dependencies versions also affect thepackage_id``), but in general Conan is smart enough to avoid downloading binaries that are not needed, for example if you are installing an application, that links statically with its dependencies, all the dependencies binaries downloads will be skipped.

Please let me know if this helps.

memsharded commented 2 weeks ago

Did the above solve the question @jbisbee? Thanks!

memsharded commented 5 days ago

Closing as responded, please create new tickets for any further question. Thanks!