docs icon indicating copy to clipboard operation
docs copied to clipboard

Cannot specify dependency with revisions and pkg id in recipe

Open MTomBosch opened this issue 3 years ago • 5 comments

Environment Details (include every applicable attribute)

  • Operating System+version:
  • Compiler+version:
  • Conan version: 1.40
  • Revisions are disabled
  • Python version:

Steps to reproduce (Include if Applicable)

Create a recipe. Add to the requires function dependencies in this format: lib/1.0@conan/stable#RREV:PACKAGE_ID#PREV where the revision is 0 for the moment. Revisions will be enabled soon but the reference should be working also with the default revision. Try to install deps locally by calling conan install . Example that we were using: self.requires(f"example/1.11@ci/baselines#0:2303205ffe848694a2cd0f49e16984ec423b58bb:0")

Logs (Executed commands with output) (Include/Attach if Applicable)

Error in requirements() method, line 18 InvalidNameException: The revision field, must contain only letters and numbers with a length between 1 and 51

MTomBosch avatar Feb 25 '22 07:02 MTomBosch

You cannot specify a package reference as a requirement in a recipe. Only a recipe reference (with or without revision: example/1.11@ci/baselines#0). The package is calculated from the applied settings while installing. If you need to freeze the binary package that is being used I recommend taking a look at the lockfiles: https://docs.conan.io/en/latest/versioning/lockfiles.html

lasote avatar Feb 25 '22 09:02 lasote

But the document here says that we can specify the reference in the following way

lib/1.0@conan/stable#RREV:PACKAGE_ID#PREV A binary package revision PREV belonging to the specific RREV

sniraimathi avatar Mar 04 '22 13:03 sniraimathi

@sniraimathi that is something that is not clear in the docs. We will fix the docs to improve that. But it is not possible to specify the package_id in recipes, as above said, it is a computed value from the profiles and other data, it doesn't make sense to specify it directly.

Moving this to the docs repo.

memsharded avatar Mar 04 '22 13:03 memsharded

+1 for misleading documentation :( thanks @memsharded and @lasote for the detailed reply.

is the pinning mechanism considered a stable feature, or is it experimental, similarly to the lock file?

Roiberko avatar Jun 27 '22 18:06 Roiberko

The pinning mechanism is recipes requires should be considered stable, as it belongs to the revisions feature, stabilized some time ago.

memsharded avatar Jun 27 '22 18:06 memsharded