Skip to content

Conan version range not working properly

Summary

One of our customers created a ticket where they can't properly use Conan's version range feature. They are encountering this error:

Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

ERROR: 'NoneType' object is not iterable. [Remote: gitlab]

After testing, I was able to reproduce this on GitLab.com: https://gitlab.com/jdasmarinas/conan-test/

Here is what is happening. When you used Conan's version range feature, it will send a GET request to $REMOTE_URL/v1/conans/search?q=${PACKAGE_NAME}%2F%2A%40${NAMESPACE}%2F${RELEASE}&ignorecase=False (which translates to $REMOTE_URL/v1/conans/search?q=${PACKAGE_NAME}/*@${NAMESPACE}/${RELEASE}&ignorecase=False after decoding).

On my test project and package, this translates to: https://gitlab.com/api/v4/projects/27439015/packages/conan/v1/conans/search?q=Hello%2F%2A%40mycompany%2Fbeta&ignorecase=False which returns this JSON:

{"results":null}

It seems that GitLab can't handle the query of Hello/*@mycompany/beta and just returns a null value.

Steps to reproduce

  1. Follow our documentation to build and publish a package.
  2. Run conan remove Hello to remove local cache.
  3. Install the newly publish package using the following conanfile.txt:
[requires]
Hello/['>0.0.1 <0.2', include_prerelease=True]@mycompany/beta

[generators]
cmake

Example Project

https://gitlab.com/jdasmarinas/conan-test/

What is the current bug behavior?

conan install will fail with an error ERROR: 'NoneType' object is not iterable. [Remote: gitlab] due to the value returned by GitLab.

What is the expected correct behavior?

Successfully install the package.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Julian Paul Dasmarinas