Conan Repository
Cloudsmith provides public & private repositories for Conan (C & C++)


Conan is a package manager C and C++.
Contextual Documentation
The examples in this document are generic. Cloudsmith provides contextual setup instructions within each repository, complete with copy n' paste snippets (with your namespace /repo pre-configured).
In the following examples:
Identifier | Description |
---|---|
OWNER | Your Cloudsmith account name or organisation name (namespace) |
REPOSITORY | Your Cloudsmith Repository name (also called "slug") |
TOKEN | Your Cloudsmith Entitlement Token (see Entitlements for more details) |
USERNAME | Your Cloudsmith username |
PASSWORD | Your Cloudsmith password |
API-KEY | Your Cloudsmith API Key |
PACKAGE_NAME | The name of your package |
PACKAGE_VERSION | The version number of your package |
Upload a Package
Upload via Conan
The endpoint for the native Conan API is:
https://conan.cloudsmith.io/OWNER/REPOSITORY/
First, you need to set up the Repository as a Conan remote, with your Cloudsmith API-Key and Username for authentication:
conan remote add OWNER-REPOSITORY https://conan.cloudsmith.io/OWNER/REPOSITORY/
conan user -p API-KEY -r OWNER-REPOSITORY USERNAME
You can then upload natively using Conan with the command:
conan upload PACKAGE_NAME/PACKAGE_VERSION --all -r OWNER-REPOSITORY
An optional USER/CHANNEL can also be provided when uploading a package; this enables multiple versions of the same package to coexist using the user/channel to create a unique version of the package version:
conan upload PACKAGE_NAME/[email protected]/CHANNEL --all -r OWNER-REPOSITORY
The user/channel will also be used as a tag on the package which will allow for filtering within the UI.
Upload via the Cloudsmith CLI or Website
Create a Package
To upload via the Cloudsmith API/CLI, you'll need to generate a package first. The following commands can be used to produce a package and collect the additional files required for upload (otherwise handled by conan upload
).
Please see the Conan documentation on creating packages for more information on building your own packages.
You can build a package with Conan by creating a new example project using new, create, and export:
conan new PACKAGE_NAME/PACKAGE_VERSION -t
conan create .
conan install .
conan build .
conan package .
conan export .
To create a package, files need to be extracted from the Conan home directory:
export CLOUDSMITH_REPOSITORY=OWNER/REPOSITORY
use _
when user/channel is treated
path=/home/circleci/.conan/data/example-conan-package/0.0.1/_/_
List files in build directory (using wildcard to skip over autogenerated id):
info_file=$(ls -d $path/package/*/conaninfo.txt)
metadata_file=( "$path/export/conanfile.py" )
manifest_file=( "$path/export/conanmanifest.txt" )
package_directory=( "$path/export" )
Create an archive in the current directory for upload (metadata only):
tar -czf conan_package.tgz --absolute-names "$package_directory"
Upload via Cloudsmith CLI
For full details of how to install and setup the Cloudsmith CLI, see Command Line Interface.
The package and additional files can then be uploaded via the Cloudsmith CLI. The following example shows an upload via the CLI.:
cloudsmith push conan "$CLOUDSMITH_REPOSITORY" conan_package.tgz \
--metadata-file "$metadata_file" \
--info-file "$info_file" \
--manifest-file "$manifest_file" \
--name "PACKAGE_NAME" \
--version "PACKAGE_VERSION"
Note: Name and Version are optional and are only required when the name and version are not available as a string within conanfile.py. Adding the name and version explicitly causes these values to take precedence over the corresponding values within the conanfile (if available and defined as a string).
Upload via Cloudsmith Website
Please see Upload a Package for details of how to upload via the Website UI.
Download / Install a Package
Setup
First, the remote repository must be created and then credentials can be added for a user as follows:
Public Repositories
conan remote add OWNER-REPOSITORY https://conan.cloudsmith.io/OWNER/REPOSITORY/
conan user -p API-KEY -r OWNER-REPOSITORY USERNAME
Private Repositories
Private Cloudsmith repositories require authentication. You can choose between two types of authentication, Entitlement Token Authentication or HTTP Basic Authentication.
The setup method will differ depending on what authentication type you choose to use.
conan remote add OWNER-REPOSITORY https://conan.cloudsmith.io/OWNER/REPOSITORY/
conan user -p TOKEN -r OWNER-REPOSITORY OWNER/REPOSITORY
conan remote add OWNER-REPOSITORY https://conan.cloudsmith.io/OWNER/REPOSITORY/
conan user -p PASSWORD -r OWNER-REPOSITORY USERNAME
conan remote add OWNER-REPOSITORY https://conan.cloudsmith.io/OWNER/REPOSITORY/
conan user -p API-KEY -r OWNER-REPOSITORY USERNAME
conan remote add OWNER-REPOSITORY https://conan.cloudsmith.io/OWNER/REPOSITORY/
conan user -p TOKEN -r OWNER-REPOSITORY token
Install a Package
Once set up, Conan can download the package by running:
conan download PACKAGE_NAME/[email protected] -r OWNER-REPOSITORY
Troubleshooting
Please see the Troubleshooting page for further help and information.
Updated almost 2 years ago