conan-io / meta-conan

Yocto layer for the Conan project
24 stars 28 forks source link

Ability to set remote priorities higher than default #43

Open ahepp opened 1 year ago

ahepp commented 1 year ago

Hi,

A different team at my company is distributing prebuilt binaries with Conan, which I want to include in my Yocto based OS image. I am a Conan novice, so apologies if there's an easy way to solve my problem that I am not seeing.

I've created a recipe for "my-package". The recipe sets CONAN_REMOTE_URL and CONAN_REMOTE_NAME. Conan finds "my-package", but it appears to be installing the dependencies from center.conan.io rather than from my remote.

I believe this is because of the default .conan/remotes.json file that seems to be generated in the Yocto build directory. This file has center.conan.io listed first in the JSON array of remotes, and I assume only packages not found on the first remote go on to my custom remote.

This quick hack has fixed my issue for now, but I'd like to be able to use mainline meta-conan. I'm happy to work on a enhancement to support this, but I'm not sure what the best way to go about it is.

I briefly attempted overriding the .conan/remotes file with my Yocto recipe, but that was not successful.

I am not familiar with Conan config URLs, but it seems like maybe I could host a config archive on artifactory and get my remote settings from there? But I would prefer to store the config settings in my Yocto recipe if at all possible.

It looks like there is already support for multiple remotes. I believe these will already be added in order to .conan/remotes.json.

Making center.conan.io the default value for for CONAN_REMOTE_URL and not adding it automatically to .conan/remotes could be an elegant solution. Then users who wish to simply add an additional remote can append to the variable, and users who wish to mess around with priority can fully override it. However that would pose a major backwards compatibility issue. So perhaps, if a change along these lines is deemed appropriate, it would need to involve a new environment variable.

I would love to hear others' thoughts on this. Especially if I'm just overlooking something simple about how Conan works.

uilianries commented 1 year ago

@ahepp What version of Conan is your company running?

You may use conan remote add along its --index option command to chose your first remote option. Plus, you can disable/enable remotes there. Please, take a look on the documentation.

ahepp commented 1 year ago

Won't the bbclass blow away outside config before starting the install stage?