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

conan config install-pkg #3648

Merged
merged 1 commit into from
Mar 20, 2024
Merged
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
33 changes: 33 additions & 0 deletions reference/commands/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,39 @@ See `conan-io/command-extensions's .conanignore <https://github.com/conan-io/com
$ conan config install /path/to/some/config.zip


.. _reference_commands_conan_config_install_pkg:

conan config install-pkg
------------------------

.. include:: ../../common/experimental_warning.inc


.. autocommand::
:command: conan config install-pkg -h


This command allows to install configuration from a Conan package stored in a Conan server.

The packages containing configuration follow some special rules:

- They must define the ``package_type = "configuration"``
- The configuration files must be packaged in the final "binary" package, following the same layout as they would for other ``conan config install`` cases.
- They cannot be used as ``requires`` of other packages, because that would result in a chicken-and-egg problem.
- They cannot contain ``requires`` to other packages
- The configuration packages are created with ``conan create`` and ``conan export-pkg`` as other packages, and uploaded to the servers with ``conan upload``

To install configuration from a Conan configuration package, it is possible:

- To generate a lockfile file with ``--lockfile-out``. This lockfile file can be passed to ``conan config install-pkg --lockfile`` (it will automatically loaded it if is named ``conan.lock`` and found in the current directory) in the future to guarantee the same exact version.
- Version ranges can be used ``conan config install-pkg "myconf/[>=1.0 <2]"`` is correct, and it will install the latest one in that range.
- ``conan config install-pkg`` always look in the server for the latest version or revision.
- If the same version and revision was downloaded and installed from the server, ``conan config install-pkg`` will be a no-op unless ``--force`` is used, in this case the configuration will be overwritten.

It is also possible to make the version of the configuration affect all packages ``package_id`` and be part of the binary model, by activating the ``core.package_id:config_mode`` conf (this is also experimental), to any available mode, like ``minor_mode``.



conan config list
-----------------

Expand Down
13 changes: 13 additions & 0 deletions whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,16 @@ always fully reproducible, no matter what happens to the original internet sourc
.. seealso::

- `the backup-sources blog post <https://blog.conan.io/2023/10/03/backup-sources-feature.html>`_


Installing configuration from Conan packages
--------------------------------------------

From Conan 2.2 it is possible to install configuration not only from git repos and http servers, but also
from Conan packages. Doing ``conan config install-pkg myconf/myversion`` over a Conan package ``myconf/myversion``
stored in a a Conan server, allows to install the configuration files inside that package. It also allows
to use version ranges to update easily to the latest one within the range, and lockfiles to achieve reproducibility.

.. seealso::

- :ref:`Read the conan config install-pkg command reference <reference_commands_conan_config_install_pkg>`