Generate a debug and release package without discarding any of them
See original GitHub issueIn my build pipeline I generate packages for debug and release build types after which I want to upload the debug and release packages to the remote server. I tried the following shell script:
conan install . --install-folder=build_debug -s build_type=Debug
conan build . --source-folder=. --build-folder=build_debug
conan package . --source-folder=. --build-folder=build_debug
conan export-pkg . @mycompany/dev --build-folder=build_debug -s build_type=Debug
conan install . --install-folder=build_release -s build_type=Release
conan build . --source-folder=. --build-folder=build_release
conan package . --source-folder=. --build-folder=build_release
conan export-pkg . @mycompany/dev --build-folder=build_release -s build_type=Release
# next pipeline stage
conan upload mypackagename/* --all -c -r my_remote
Both packages (Debug and Release) will result in different package hashes as expected. The problem that I have is that export-pkg is deleting my previously generated package in the cache. When I run conan upload, I am not able to upload a debug version and release version to the remote server.
I tried to run conan upload after the debug package is generated, and do the same thing after the release package is generated. This also does not work: when running conan install for packages that depend on mypackagename/* only a debug or release version is found.
I am a bit confused on how to approach the situation when I want to upload different package versions for debug and release builds. What would be an appropriate way to solve this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)

Top Related StackOverflow Question
conan packageis not removing anything from the cache. It only seems to flag or invalidate something, Then when runningconan export-pkgit removes the previously cached results for the package that I am exporting. The snippet that I have provided in my previous post is the example:conan export-pkgfor both debug and release. Result is two packages in the cache, which is correct.conan package . --source-folder=. --build-folder=build_debugagain. Nothing happens in the cache yet.conan export-pkg . @mycompany/dev -bf=build_debug -s build_type=Debugagain. Now the release package is removed from the cache. The debug also actually, but is then added again as a result of running this command.My conan version is 1.33.0 and my OS is Ubuntu 18.04.5 LTS (Bionic Beaver)
Yes, you are right, this is a side effect of an existing limitation of the current Conan cache: It can only host 1 revision at a time. When you are creating a new revision, because
exports_sourcesmodified it, the previous one is replaced. The next iteration of the cache (designed for Conan 2.0) will be able to contain multiple revisions, in that sense the binaries will not be removed, they will remain there in a previous revision, so you could use them if you want (by expliciting the revision or using a lockfile).Thanks for the feedback!, I think this can be closed now.