Skip to content

Commit

Permalink
conan config install-pkg (#3648)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored Mar 20, 2024
1 parent a883404 commit b3e31c4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
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>`

0 comments on commit b3e31c4

Please sign in to comment.