Reputation: 113
I would like to update the channel of some existing conan packages in my local conan/artifactory server without having to recompile/rebuild them.
Some background: we have some packages that were originally downloaded from a non-local server. These packages were uploaded to our local server, so we'll not be dependent to a connection to a 3rd party server. We set the remotes.json file to prefer the local server over the global server, however, for some reason - in some stations packages are referenced to the global server. This, and the fact that some packages were changed in the global server and creates new conflicts & issues, we decided to change the channel of our local packages. This will also help to make sure that no-one outside of our project changes the packages content (also happened few times when someone update the updated package from the server)
What we want is: To have the same conan packages but at a different channel: for example - instead of libjpeg/9c@bincrafters/stable
we want the very same package but libjpeg/9c@local_channel/stable
. We also need to change the package requirements file also to be dependent on our local channel and not on other channels. I have searched a method to do so and only found this: https://github.com/conan-io/conan/issues/3283. One of the answers suggested that it was impossible, as it was also require a change with the package version - changing the package version require a rebuild. I don't want to change the version of the package, only the channel. Is that possible to do so without having to rebuild the package?
Upvotes: 1
Views: 4515
Reputation: 3887
I would like to update the channel of some existing conan packages in my local conan/artifactory server without having to recompile/rebuild them.
Conan copy is what you are looking for:
conan copy libjpeg/9c@bincrafters/stable local_channel/stable --all
conan upload libjpeg/9c@local_channel/stable --all -r my_remote
Or, you can update directly in your Artifactory instance, by moving/copying Conan packages (artifacts). However, it will not update your dependencies and your local cache.
I have searched a method to do so and only found this: https://github.com/conan-io/conan/issues/3283.
That question is from 2018. Many new features were introduced since then, including copying artifact on Artifactory. Anyway, https://github.com/conan-io/conan/issues is the best place for asking anything, Conan team will answer there.
I don't want to change the version of the package, only the channel. Is that possible to do so without having to rebuild the package?
Conan copy command copies everything, including packages dependencies, so you don't need to rebuild. However, you have to update their dependencies too and it won't work. As your packages are cached, you will need to update their dependencies references too, not only updating a recipe and magically Conan solves it. There are few options:
conan remove libjpeg/9c@bincrafters/stable -f
conan alias libjpeg/9c@local_channel/stable libjpeg/9c@bincrafters/stable
So you don't need to update your packages and rebuild them, but as you can see it's an ugly workaround.
Upvotes: 2