The goal of the revisions feature is to achieve package immutability, the packages in a server are never overwritten.
Revisions achieve immutability. For achieving reproducible builds and reproducible dependencies, lockfiles are used. Lockfiles can capture an exact state of a dependency graph, down to exact versions and revisions, and use it later to force their usage, even if new versions or revisions were uploaded to the servers.
Learn more about lockfiles here.
How it works¶
In the client
When a recipe is exported, Conan calculates a unique ID (revision). For every change, a new recipe revision (RREV) will be calculated. By default it will use the checksum hash of the recipe manifest.
Nevertheless, the recipe creator can explicitly declare the revision mode, it can be either
scm(uses version control system or raises) or
hash(use manifest hash).
When a package is created (by running conan create or conan export-pkg) a new package revision (PREV) will be calculated always using the hash of the package contents. The packages and their revisions (PREVs) belongs to a concrete recipe revision (RREV). The same package ID (for example for Linux/GCC5/Debug), can have multiple revisions (PREVs) that belong to a concrete RREV.
If a client requests a reference like
lib/1.0@conan/stable, Conan will automatically retrieve the latest revision in case
the local cache doesn’t contain any revisions already. If a client needs to update an existing revision, they have to ask for updates explicitly
-u, --update argument to conan install command. In the client cache there is
only one revision installed simultaneously.
The revisions can be pinned when you write a reference (in the recipe requires, a reference in a conan install command,…) but if you don’t specify a revision, the server will retrieve the latest revision.
You can specify the references in the following formats:
||Latest RREV for
||Specific RREV for
||A binary package belonging to the specific RREV|
||A binary package revision PREV belonging to the specific RREV|
In the server
By using a new folder layout and protocol it is able to store multiple revisions, both for recipes and binary packages.
How to activate the revisions¶
You have to explicitly activate the feature by either:
[general]section of your conan.conf file (preferred)
- Setting the
Take into account that it changes the default Conan behavior. e.g:
- A client with revisions enabled will only find binary packages that belong to the installed recipe revision. For example, If you create a recipe and run conan create . user/channel and then you modify the recipe and export it (conan export . user/channel), the binary package generated in the conan create command doesn’t belong to the new exported recipe. So it won’t be located unless the previous recipe is recovered.
- If you generate and upload N binary packages for a recipe with a given revision, then if you modify the recipe, and thus the recipe revision, you need to build and upload N new binaries matching that new recipe revision.