2

我有一个使用 Travis-CI 和柯南的 C++ 项目。我在 Travis-CI 上构建的 Linux 在尝试下载 libcurl 时失败:

libcurl/7.61.1@bincrafters/stable: Building your package in /home/travis/.conan/data/libcurl/7.61.1/bincrafters/stable/build/b6dbf799dd7e6d1c740e159bea361666320a3db8
libcurl/7.61.1@bincrafters/stable: Configuring sources in /home/travis/.conan/data/libcurl/7.61.1/bincrafters/stable/source
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:150: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
ERROR: Error downloading file https://curl.haxx.se/download/curl-7.61.1.tar.gz: 'HTTPSConnectionPool(host='curl.haxx.se', port=443): Max retries exceeded with url: /download/curl-7.61.1.tar.gz (Caused by SSLError(CertificateError("hostname 'curl.haxx.se' doesn't match 'c.sni.fastly.net'",),))'
Waiting 5 seconds to retry...
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:150: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
libcurl/7.61.1@bincrafters/stable: WARN: Trying to remove corrupted source folder
libcurl/7.61.1@bincrafters/stable: WARN: This can take a while for big packages
ERROR: libcurl/7.61.1@bincrafters/stable: Error in source() method, line 131
    tools.get("https://curl.haxx.se/download/curl-%s.tar.gz" % self.version)
    ConanException: Error downloading file https://curl.haxx.se/download/curl-7.61.1.tar.gz: 'HTTPSConnectionPool(host='curl.haxx.se', port=443): Max retries exceeded with url: /download/curl-7.61.1.tar.gz (Caused by SSLError(CertificateError("hostname 'curl.haxx.se' doesn't match 'c.sni.fastly.net'",),))'
The command "conan install .. --build missing" exited with 1.

根据错误中的建议,我试图让 Travis 使用 Python3 来查看是否可以解决问题,但我没有运气。首先,我添加python3packages:这样的内容:

matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required
      env:
        - CC_COMPILER=gcc-7
        - CXX_COMPILER=g++-7
        - BUILD_TYPE=RelWithDebInfo
      addons:
        apt:
          packages:
            - python3
            - gcc-7
            - g++-7
          sources:
            - ubuntu-toolchain-r-test

但我收到与上述相同的错误。然后我尝试alias了命令:

install:
  - |
    if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
      sudo pip install conan
      alias python=python3
    fi

然而,我得到了同样的结果。

如何让 Travis-CI 将 python3 用于柯南?还是有另一种方法可以让我的conan install命令起作用?

谢谢!

4

2 回答 2

1

生成的默认 CI 脚本conan new pkg/version -s -cilg可能会有所帮助。它们包含以下内容:

linux: &linux
   os: linux
   dist: xenial
   sudo: required
   language: python
   python: "3.6"
   services:
     - docker

matrix:
   include:
      - <<: *linux
        env: ...

install:
  - chmod +x .travis/install.sh
  - ./.travis/install.sh

和安装脚本:

pip install conan --upgrade
pip install conan_package_tools

conan user

所以它没有被声明为包,而是在根级别定义,这似乎足以在以后将它与 bare 一起使用pip install

于 2018-11-07T15:52:15.697 回答
0

好吧,如果我正确阅读它,python3 不是这里的问题。错误是:

CertificateError("hostname 'curl.haxx.se' doesn't match 'c.sni.fastly.net'",

所以 ssl 有点可疑。Python2 在使用 ssl / https 时确实会产生不安全的平台警告,但这很少是问题。

至于 Travis 上的 python3 - 我个人无法让柯南使用 python3 在 CI 中工作。但基本步骤是:

   apt:
      packages:
        - python3
        - python3-pip
...

使用 python3 安装柯南:

   sudo pip3 install conan

请注意,在您install调用的示例中pip- 它使用 python3 安装柯南,并且当从命令行调用时它将由 python2 运行,尽管有别名。要使用的解释器实际上在conan脚本中。

于 2019-01-09T13:30:16.157 回答