Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/metadata #3283

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Conan extensions examples
extensions/commands/custom_commands
extensions/deployers/builtin_deployers
extensions/deployers/custom_deployers
extensions/metadata/test_package
5 changes: 5 additions & 0 deletions examples/extensions/metadata/test_package.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. _examples_extensions_metadata_test_package:

Storing ``test_package`` folder in metadata
===========================================

52 changes: 51 additions & 1 deletion reference/commands/download.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ conan download

$ conan download -h
usage: conan download [-h] [-v [V]] [-f FORMAT] [--only-recipe]
[-p PACKAGE_QUERY] -r REMOTE [-l LIST]
[-p PACKAGE_QUERY] -r REMOTE [-m METADATA] [-l LIST]
[pattern]

Download (without installing) a single conan package from a remote server.
Expand Down Expand Up @@ -37,6 +37,9 @@ conan download
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


Expand Down Expand Up @@ -89,3 +92,50 @@ If you just want to download the packages belonging to a specific setting, use t


If the ``--format=json`` formatter is specified, the result will be a "PackageList", compatible with other Conan commands, for example the ``conan upload`` command, so it is possible to concatenate a ``download + upload``, using the generated json file. See the :ref:`Packages Lists examples<examples_commands_pkglists>`.


Downloading metadata
--------------------

The metadata files of the recipes and packages are not downloaded by default It is possible to explicitly retrieve them with the ``conan download --metadata=xxx`` argument.
The main arguments are the same as above, and Conan will download the specified packages, or skip them if they are already in the cache:

.. code-block:: bash

$ 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

If only one or several metadata folders or sets of files are desired, it can also be specified:


.. code-block:: bash

$ 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

If we want to retrieve all the "logs" metadata of a given dependency graph, we can use packages-lists to do it:

.. code-block:: bash

$ conan install . --format=json > graph.json
# compute the graph and install dependencies, but won't retrieve metadata files
$ conan list --graph=graph.json --format=json > pkglist.json
# Will compute the list of all recipes and binaries in the graph
# Now, the download from the "remote" origin:
$ conan download --list=pkglist.json --metadata="logs/*" -r=remote
# Will download the "logs" metadata belonging to the items in the graph
# Only of the packages that were downloaded in the "install" step
$ conan cache path dep/0.1 --folder=metadata
/path/to/dep/0.1/recipe/metadata/folder
# We have access to the folder of the recipe metadata
$ conan cache path dep/0.1:package_id --folder=metadata
/path/to/dep/0.1/pkg/metadata/folder
# We have access to the folder of the package metadata

When the metadata has been downloaded, it is possible to check it with the ``conan cache path`` command for an individual recipe
or package binary metadata. Likewise it is possible to collect it with a ``deployer`` using the ``conanfile`` ``recipe_metadata_folder`` and
``package_metadata_folder``.

For more information see the :ref:`metadata section<reference_extensions_metadata>`.
9 changes: 6 additions & 3 deletions reference/commands/upload.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ section <conan_repositories>`.

$ conan upload -h
usage: conan upload [-h] [-v [V]] [-f FORMAT] [-p PACKAGE_QUERY] -r REMOTE
[--only-recipe] [--force] [--check] [-c] [--dry-run]
[-l LIST]
[pattern]
[--only-recipe] [--force] [--check] [-c] [--dry-run]
[-l LIST] [-m METADATA]
[pattern]

Upload packages to a remote.

Expand Down Expand Up @@ -49,6 +49,9 @@ section <conan_repositories>`.
-c, --confirm Upload all matching recipes without confirmation
--dry-run Do not execute the real upload (experimental)
-l LIST, --list LIST Package list file
-m METADATA, --metadata METADATA
Upload the metadata, even if the package is already in
the server and not uploaded


The ``conan upload`` command can upload packages to 1 server repository specified by the ``-r=myremote`` argument.
Expand Down
8 changes: 5 additions & 3 deletions reference/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ Conan can be extended in a few ways, with custom user code:
- The ``cmd_wrapper.py`` extension allows to inject arbitrary command wrappers to any
``self.run()`` recipe command invocation, which can be useful to inject wrappers as
parallelization tools
- **Deployers**, a mechanism to facilitate copying files from one folder, usually the Conan cache, to user folders
- **Metadata files**: Store files like logs, tests executables, tests results, heavy debugging artifacts, etc,
together with recipes and packages, in an efficient, convenient and traceable way.
- The package signing extension allows to sign and verify packages at upload and install time
respectively
- Deployers, a mechanism to facilitate copying files from one folder, usually the Conan cache, to user folders


.. note::

Expand All @@ -38,7 +39,7 @@ Conan can be extended in a few ways, with custom user code:
Contents:

.. toctree::
:maxdepth: 2
:maxdepth: 1

extensions/python_requires
extensions/custom_commands
Expand All @@ -50,4 +51,5 @@ Contents:
extensions/profile_plugin
extensions/command_wrapper
extensions/package_signing
extensions/metadata

Loading