Skip to content

Conan version ranges not handled properly by GitLab

Summary

When running conan info with a version range, i.e. [~1.1.2], it does not return any packages from the GitLab remote, even though packages matching this version range do exist.

Steps to reproduce

  1. Upload several packages with different version but the same user/channel, i.e. mypackage/1.1.2@some-group/stable and mypackage/1.1.3@some-group/stable
  2. Add Gitlab as a remote (i.e. conan remote add gitlab https://gitlab.com/api/v4/packages/conan)
  3. Empty local Conan cache (just to be sure, i.e. conan remove *)
  4. Run conan info with a version range, i.e. conan info mypackage/[~1.1.2]@some-group/stable -r gitlab
  5. Check results.

Example Project

No public example available at this point in time.

What is the current bug behavior?

Conan returns an error because no result is found, i.e.:

ERROR: Version range '~1.1.2' from requirement 'mypackage/[~1.1.2]@some-group/stable' required by 'virtual' could not be resolved in local cache

What is the expected correct behavior?

Conan shows at least version 1.1.3 (and maybe also 1.1.2).

Relevant info

We noticed this because we have a package that has a py_requires set using a version range as mentioned above. After clearing our local cache, running conan info in to package that actually had this requirement, resulted in an error:

Error loading conanfile at 'C:\Users\amoonen\.conan\data\some-package\1.0.1\some-user\stable\export\conanfile.py': Version range '~1.1.2' from requirement 'conan_python_tools/[~1.1.2]@some-user/stable' required by 'py_require' could not be resolved in local cache

Because of that error, we tried running conan info on the package it is depending on (via the py_require) and then we ran into the issue described above. We compared this to the behavior of Conan Center, by running:

conan info zlib/[~1.2.0]@conan/stable --remote conan-center

This will result in a version of zlib being shown (for it was 1.2.11).

One of the things we noticed, was that the Gitlab "Conan remote" has different capabilities than conan center. Maybe this is why certain things are not working correctly.

Gitlab:

DEBUG :rest_client_common.py[156]: REST: ping: https://gitlab.com/api/v4/packages/conan/v1/ping
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: []

Conan Center:

DEBUG :rest_client_common.py[156]: REST: ping: https://conan.bintray.com/v1/ping
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: ['complex_search', 'checksum_deploy', 'revisions']

Output of checks

This bug happens on GitLab.com

Possible fixes

I would expect the GitLab Conan Remote to support the same capabilities as the official conan center, in order for it to be a decent alternative.