Conan: Python 2 + Conan 1.13.3 "revision field must contain only letters and numbers"

Created on 27 Mar 2019  路  10Comments  路  Source: conan-io/conan

To help us debug your issue please explain:

Ubuntu 16.04
Python 2.7
Conan v1.13.3

Recipe:

# (C)2019 Red Lion Controls, Inc. All rights reserved. Red Lion, the Red Lion logo and Sixnet are registered trademarks
# of Red Lion Controls, Inc. All other company and product names are trademarks of their respective owners.

from conans import ConanFile, CMake, tools


class NewProject(ConanFile):
    name = 'NewProject'
    version = tools.load("version.txt").strip() + '-1'
    license = 'Proprietary'
    url = 'https://bitbucket.org/redlionstl/newproject'
    description = 'FIXME: This is my cool new project'
    settings = 'os', 'compiler', 'build_type', 'arch'
    options = {
        'shared': [True, False],
        'with_docs': [True, False],
        'public_docs': [True, False]
    }
    default_options = 'shared=True', 'with_docs=True', 'public_docs=False'
    generators = 'cmake'

    build_requires = (
        'googletest/1.8.1@wsbu/stable',
        'wsbu-docgen/[^0.1.3]@wsbu/stable'
    )

    exports = 'version.txt'
    scm = {
        'type': 'git',
        'url': 'auto',
        'revision': 'auto'
    }

    def configure(self):
        # Googletest should never be built as a shared library... it's just all kinds of broken
        self.options['googletest'].shared = False

    def build(self):
        cmake = self.cmake
        if self.options.with_docs:
            cmake_defs = {
                'WSBU_DOX_INSTALL': 'ON',
                'WSBU_DOX_PUBLIC': 'ON' if self.options.public_docs else 'OFF'
            }
        else:
            cmake_defs = {}
        cmake.configure(defs=cmake_defs)
        cmake.build()
        cmake.test()

    def package(self):
        self.cmake.install()

    def package_info(self):
        self.cpp_info.libs = ['newproject']

    @property
    def cmake(self):
        return CMake(self)

Error:

captain@Jesko:/home/david/tmp$ conan create . foo/bar

Python 2 will soon be deprecated. It is strongly recommended to use Python 3 with Conan:
https://docs.conan.io/en/latest/installation.html#python-2-deprecation-notice

Exporting package recipe
NewProject/0.0.1-1@foo/bar exports: Copied 1 '.txt' file: version.txt
NewProject/0.0.1-1@foo/bar: Repo origin deduced by 'auto': [email protected]/davidzemon/foobar
NewProject/0.0.1-1@foo/bar: WARN: Repo status is not pristine: there might be modified files
NewProject/0.0.1-1@foo/bar: Revision deduced by 'auto': /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
677e7100468553806ea3330ef906e12f1032a8e0
NewProject/0.0.1-1@foo/bar: A new conanfile.py version was exported
NewProject/0.0.1-1@foo/bar: Folder: /home/captain/.conan/data/NewProject/0.0.1-1/foo/bar/export
ERROR: The revision field, must contain only letters and numbers with a length between 1 and 51

The error happens in a Docker container. When I run on my host (Ubuntu 18.04, Python 3, Conan 1.13.3), I cannot replicate the error. When I downgrade the version of Conan in Docker to 1.12.x, the bug goes away. This is what makes me think it is A) a bug in Conan rather than my recipe and B) specific to Python 2.

high bug

Most helpful comment

I do not know if this error is not similar to one that @jgsogo saw 10 days ago, reported by Daryl Fortney

All 10 comments

Also, could you make it more specific which "revision" you're referring to in this error? I'm not sure if it's referring to recipe revision or SCM revision.

I do not know if this error is not similar to one that @jgsogo saw 10 days ago, reported by Daryl Fortney

@DavidZemon quick question: is the code of the recipe in a shared folder between the host and the docker image? It might be related to that, not to python2/3

It is. I'm not considering any issues with Docker because I can, from within Docker, downgrade Conan to 1.12.3 and the issue goes away.

I think I got it. The issue is produced when capturing the commit with "git". I think this might be related with this non-captured output: /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) 677e7100468553806ea3330ef906e12f1032a8e0 that is being considered the revision.

I think this PR should fix it: https://github.com/conan-io/conan/pull/4845~~ Probably that PR is related but not the fix.

I'll try to reproduce.

I cannot reproduce, but could you try with this pip package in the docker?

pip install conan && pip install --index-url https://test.pypi.org/simple/ conan==1.13.4.dev1553760758

I think I got it. The issue is produced when capturing the commit with "git". I think this might be related with this non-captured output: /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) 677e7100468553806ea3330ef906e12f1032a8e0 that is being considered the revision.

I think this PR should fix it: #4845 Probably that PR is related but not the fix.

lasote for prez ;)

The bug is apparently fixed in version 1.14.0. That _must_ have been just released today/yesterday, right? Please tell me I'm not going crazy. When I reported this bug yesterday, pip install --upgrade conan _was_ installing 1.13.3, right??? I verified just now that 1.13.3 has the bug and 1.14.0 does not.

For reference, yes, conan==1.13.4.dev1553760758 fixes the bug as well.

Great to hear it is fixed. I would love to know that @keysight-daryl one is also solved (probably it was related to Git output too), although we will adopt the same approach for other subprocess calls: https://github.com/conan-io/conan/issues/4859

Was this page helpful?
0 / 5 - 0 ratings