conan install --update --all or something to allow updating all local packages to latest version.
Also submitted here: https://github.com/conan-io/wishlist/issues/214
The conan install command always operates targetting a conanfile.py or a reference to compute the graph and then (if specified) update the graph. So I don't see conan install as the right command. Can I ask what is your use case? Why is it not enough to update "by project"?
I'd like the ability to upgrade my Conan packages without having to go to Conan-Center or Bincrafters and manually look up what the latest version is.
The conanfile.py specifies the version explicitly, so it can't do that.
Instead, I'd like to be able to update installed packages, clean out outdated ones, and pin package versions if needed. I'd like to be able to inspect Conan's cache and clean it out as needed.
Basically, I want the brew interface:
Thanks for your response!
I'd like the ability to upgrade my Conan packages without having to go to Conan-Center or Bincrafters and manually look up what the latest version is.
You don't need to go to the central repository to check the latest version of a package. The command conan install --update exists, but you need to do it in every project using Conan, to upgrade the packages in the dependency tree of the project.
That is the main difference with brew. With brew, the "consumer" of the installed bottles is the "system" or you as a user, but there is only one consumer. In the other hand with Conan, the consumer is any project or another package (a conanfile.txt or conanfile.py with requirements), so without checking all consumers, you cannot know which dependencies are used and which ones should be upgraded.
Also the Conan cache is exactly that, a cache, with brew I won't call it cache, it is an storage where the applications are installed.
The conanfile.py specifies the version explicitly, so it can't do that.
You can use version ranges also, and the recipe will check in the remote if there is a new version available, but as I said, from a consumer package. We could develop a feature where we could iterate the local cache packages and check the remotes for updates, but it doesn't guarantee that the dependencies of your project will use the new ones, only if you are using a compatible version range, so for me it makes no much sense to do a "global upgrade" but upgrade each project individually. That is also because brew do not version the packages, so you get the only/latest available.
It's not immediately obvious to me how to use it in this way:
┌─[adam][hapkido][±][feature/refactor-moves ✓][~/CDT-plusplus]
└─▪ conan install --update
usage: conan install [-h] [-g GENERATOR] [-if INSTALL_FOLDER] [-m [MANIFESTS]]
[-mi [MANIFESTS_INTERACTIVE]] [-v [VERIFY]]
[--no-imports] [-j JSON] [-b [BUILD]] [-e ENV]
[-o OPTIONS] [-pr PROFILE] [-r REMOTE] [-s SETTINGS] [-u]
path_or_reference
conan install: error: the following arguments are required: path_or_reference
ERROR: Exiting with code: 2
What do I use for path_or_reference?
The conanfile.py/conanfile.txt of your project or a reference already installed in the cache. As I said, you need a "root" node to build the dep graph to be updated, you cannot just update the whole cache, unless you have a project that depends on all the packages in your local cache.
Okay, that makes sense, but version ranges in conanfile.py don't work.
From the conaninfo.txt generated by conan install --update conanfile.py:
[settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=10.0
os=Macos
[requires]
Catch2/2.Y.Z
boost/1.Y.Z
date/2.Y.Z
docopt/0.6.2
gsl_microsoft/2.Y.Z
[options]
[full_settings]
arch=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=10.0
os=Macos
[full_requires]
Catch2/2.5.0@catchorg/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
boost/1.69.0@conan/stable:411d816e9b8d6cb0bb1ef6e5be8b2a94b8b17c04
bzip2/1.0.6@conan/stable:534dcc368c999e07e81f146b3466b8f656ef1f55
date/2.4.1@bincrafters/stable:60e5a79ffac27b15987d7fdaae6c763ec6371644
docopt/0.6.2@conan/stable:f8bda7f0751e4bc3beaa6c3b2eb02d455291c8a2
gsl_microsoft/2.0.0@bincrafters/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
zlib/1.2.11@conan/stable:534dcc368c999e07e81f146b3466b8f656ef1f55
If I change conanfile.py to use boost/1.Y.Z I get:
┌─[adam][hapkido][±][feature/refactor-moves U:2 ?:4 ✗][~/CDT-plusplus/tools]
└─▪ ./build.sh
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=RelWithDebInfo
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=10.0
os=Macos
os_build=Macos
[options]
[build_requires]
[env]
boost/1.Y.Z@conan/stable: Not found in local cache, looking in remotes...
boost/1.Y.Z@conan/stable: Trying with 'conan-center'...
boost/1.Y.Z@conan/stable: Trying with 'bincrafters'...
ERROR: Failed requirement 'boost/1.Y.Z@conan/stable' from 'PROJECT'
ERROR: Unable to find 'boost/1.Y.Z@conan/stable' in remotes
ERROR: conanbuildinfo.txt file not found in /Users/adam/CDT-plusplus/build
It is required for this command
You can generate it using 'conan install'
*********************************
No test configuration file found!
*********************************
Usage
ctest [options]
So I need to run this command, inspect [full_requires] from conaninfo.txt, and then update conanfile.py/txt accordingly?
Also, I was using boost/1.69.0 already, it marked that as older than current, I'm guessing because zlib/1.2.11@conan/stable is newer than the version it was built with before?
It makes sense that a package is out of date if some of its dependencies are, but I don't declare those explicitly.
boost/1.Y.Z is not a valid version range. That is the "hashed" value that conan uses internally to compute the package ID.
https://docs.conan.io/en/latest/mastering/version_ranges.html
Thanks, version range expressions work.
Is there any way to update conanfile.txt versions with this command? Similar to how npm/yarn works
Hi @bugproof
No, right now there isn't. We are considering to add something, but so far not a priority, as adding it to the file is easy enough.