conan download

$ conan download -h
usage: conan download [-h] [-f FORMAT] [--out-file OUT_FILE]
                      [-v [{quiet,error,warning,notice,status,,verbose,debug,v,trace,vv}]]
                      [-cc CORE_CONF] [--only-recipe] [-p PACKAGE_QUERY] -r
                      REMOTE [-m METADATA] [-l LIST]
                      [pattern]

Download (without installing) a single conan package from a remote server.

It downloads just the package, but not its transitive dependencies, and it will not call
any generate, generators or deployers.
It can download multiple packages if patterns are used, and also works with
queries over the package binaries.

positional arguments:
  pattern               A pattern in the form
                        'pkg/version#revision:package_id#revision', e.g:
                        "zlib/1.2.13:*" means all binaries for zlib/1.2.13. If
                        revision is not specified, it is assumed latest one.

options:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        Select the output format: json
  --out-file OUT_FILE   Write the output of the command to the specified file
                        instead of stdout.
  -v [{quiet,error,warning,notice,status,,verbose,debug,v,trace,vv}]
                        Level of detail of the output. Valid options from less
                        verbose to more verbose: -vquiet, -verror, -vwarning,
                        -vnotice, -vstatus, -v or -vverbose, -vv or -vdebug,
                        -vvv or -vtrace
  -cc CORE_CONF, --core-conf CORE_CONF
                        Define core configuration, overwriting global.conf
                        values. E.g.: -cc core:non_interactive=True
  --only-recipe         Download only the recipe/s, not the binary packages.
  -p PACKAGE_QUERY, --package-query PACKAGE_QUERY
                        Only download packages matching a specific query. e.g:
                        os=Windows AND (arch=x86 OR compiler=gcc)
  -r REMOTE, --remote REMOTE
                        Download from this specific remote
  -m METADATA, --metadata METADATA
                        Download the metadata matching the pattern, even if
                        the package is already in the cache and not downloaded
  -l LIST, --list LIST  Package list file

从指定的远程仓库将 recipe 和二进制文件下载到本地缓存。

注意

请注意,与 conan install 不同,conan download 不会下载已下载包的任何传递性依赖项。

conan download 命令可以通过 -r=myremote 参数将包下载到 1 个服务器仓库。

它有两种可能且互斥的输入方式:

  • conan download <pattern>:基于模式匹配的 recipe,模式类似于 conan list <pattern>

  • conan download --list=<pkglist>:上传 pkglist JSON 文件中指定的构件。

您可以使用模式像其他命令(如 conan list(参见那里的模式文档 conan list)或 conan upload)一样下载特定的引用。

# download latest revision and packages for all openssl versions in foo remote
$ conan download "openssl/*" -r foo

注意

conan download 默认只下载最新修订版本。如果您想下载比最新版本更多的修订版本,可以在引用模式参数的修订部分使用通配符。

您也可以只下载 recipe(在这种情况下,会选择模式中的所有修订版本,而不仅仅是最新版本)。

# download all recipe revisions for zlib/1.2.13
$ conan download "zlib/1.2.13#*" -r foo --only-recipe

如果您只想下载属于特定设置的包,请使用 --package-query 参数。

$ conan download "zlib/1.2.13#*" -r foo --package-query="os=Linux and arch=x86"

如果指定了 --format=json 格式化程序,结果将是一个“PackageList”,与其他 Conan 命令兼容,例如 conan upload 命令,因此可以使用生成的 JSON 文件连接 download + upload。请参阅 Packages Lists 示例

下载元数据

Recipe 和包的元数据文件默认不会下载。可以使用 conan download --metadata=xxx 参数显式检索它们。主要参数与上面相同,Conan 将下载指定的包,或者在它们已在缓存中时跳过它们。

$ conan download pkg/0.1 -r=default --metadata="*"
# will download pgkg/0.1 recipe with all the recipe metadata
# And also all package binaries (latest package revision)
# with all the binaries metadata

如果只需要一个或几个元数据文件夹或文件集,也可以指定。

$ conan download pkg/0.1 -r=default --metadata="logs/*" --metadata="tests/*"
# Will download only the logs and tests metadata, but not other potential metadata files

有关更多信息,请参阅 元数据部分