conan-io / docs

conan.io reStructuredText documentation
http://docs.conan.io
MIT License
104 stars 352 forks source link

[bug] conan info displays build requirements even though documentation states otherwise #1566

Open KepptnKool opened 4 years ago

KepptnKool commented 4 years ago

When executing conan info on a conanfile also the packages in the build requires section are displayed. This also applies to transitive build requirements.

The documentation states, that build requirements are ignored by conan info. Specifically it states this:

Build requirements are not listed in conan info nor are represented in the graph (with conan info --graph).

My expectation is that conan info ignores all build requirements.

Environment Details

Steps to reproduce

conanfilea.txt

[requires]
boost/1.71.0@conan/stable
example/1.0.0@user/test

[build_requires]
cmake_installer/3.16.1@conan/stable

[generators]
cmake

conanfileb.py

from conans import ConanFile
import os
class ExampleConan(ConanFile):
    name = "example"
    version = "1.0.0"
    license = "mylicense"
    settings = "os", "compiler", "build_type", "arch"
    generators = "cmake"
    requires = (
        "zlib/1.2.11@conan/stable"
    )
    build_requires = "cmake_installer/3.15.3@conan/stable"

    def build(self):
        pass

    def package(self):
        pass

Then execute the following:

conan create conanfileb.py user/test && conan info conanfilea.txt -db

Logs

Note that cmake_installer appears in both versions in the output. That means, that the build requirement from the conanfilea.txt as well as the trasntive build requirement from conanfileb.py are displayed.

root@0da710da3a0e:/tmp# conan create conanfileb.py user/test && conan info conanfilea.txt -db
bzip2/1.0.8@conan/stable: Forced build from source
zlib/1.2.11@conan/stable: Forced build from source
boost/1.71.0@conan/stable: Forced build from source
example/1.0.0@user/test: Forced build from source
cmake_installer/3.15.3@conan/stable: Forced build from source
cmake_installer/3.16.1@conan/stable: Forced build from source
conanfilea.txt
    ID: affe26b56e2352e50699aa6b2d376fb2b28a2cde
    BuildID: None
    Requires:
        boost/1.71.0@conan/stable
        example/1.0.0@user/test
    Build Requires:
        cmake_installer/3.16.1@conan/stable
boost/1.71.0@conan/stable
    ID: 6a6207f6b8ad5cd355e8292e4efe81c5ae8e97f1
    BuildID: None
    Remote: COMPANYSERVER
    URL: https://github.com/lasote/conan-boost
    License: Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt
    Recipe: Cache
    Revision: 0
    Binary: Build
    Binary remote: None
    Creation date: 2019-09-14 11:19:31
    Required by:
        conanfilea.txt
    Requires:
        zlib/1.2.11@conan/stable
        bzip2/1.0.8@conan/stable
bzip2/1.0.8@conan/stable
    ID: 3df6ebb8a308d309e882b21988fd9ea103560e16
    BuildID: None
    Remote: COMPANYSERVER
    URL: https://github.com/conan-community/conan-bzip2
    Homepage: http://www.bzip.org
    License: bzip2-1.0.8
    Author: Conan Community
    Topics: conan, bzip2, data-compressor, file-compression
    Recipe: Cache
    Revision: 0
    Binary: Build
    Binary remote: None
    Creation date: 2019-08-20 09:27:12
    Required by:
        boost/1.71.0@conan/stable
cmake_installer/3.15.3@conan/stable
    ID: 44fcf6b9a7fb86b2586303e3db40189d3b511830
    BuildID: None
    Remote: COMPANYSERVER
    URL: https://github.com/conan-community/conan-cmake-installer
    Homepage: https://github.com/Kitware/CMake
    License: BSD-3-clause
    Author: Conan Community
    Topics: conan, cmake, build, installer
    Recipe: Cache
    Revision: 0
    Binary: Build
    Binary remote: None
    Creation date: 2019-11-01 09:42:59
    Required by:
        example/1.0.0@user/test
cmake_installer/3.16.1@conan/stable
    ID: 44fcf6b9a7fb86b2586303e3db40189d3b511830
    BuildID: None
    Remote: COMPANYSERVER
    URL: https://github.com/conan-community/conan-cmake-installer
    Homepage: https://github.com/Kitware/CMake
    License: BSD-3-clause
    Author: Conan Community
    Topics: conan, cmake, build, installer
    Recipe: Cache
    Revision: 0
    Binary: Build
    Binary remote: None
    Creation date: 2020-01-27 06:58:08
    Required by:
        conanfilea.txt
example/1.0.0@user/test
    ID: 48cd815bc80e20569acd9d2a2a3973827691aa1e
    BuildID: None
    Remote: None
    License: mylicense
    Recipe: Cache
    Revision: d339af35c002e3dcc595911400c13cdd
    Binary: Build
    Binary remote: None
    Creation date: 2020-02-19 09:57:35
    Required by:
        conanfilea.txt
    Requires:
        zlib/1.2.11@conan/stable
    Build Requires:
        cmake_installer/3.15.3@conan/stable
zlib/1.2.11@conan/stable
    ID: 76f87539fc90ff313e0b3182641a9bb558a717d2
    BuildID: None
    Remote: COMPANYSERVER
    URL: http://github.com/conan-community/conan-zlib
    Homepage: https://zlib.net
    License: Zlib
    Author: Conan Community
    Topics: conan, zlib, compression, zip
    Recipe: Cache
    Revision: 0
    Binary: Build
    Binary remote: None
    Creation date: 2019-09-04 19:48:42
    Required by:
        boost/1.71.0@conan/stable
        example/1.0.0@user/test
memsharded commented 4 years ago

Hi @KepptnKool

It doesnt seem a bug, but that the docs is a bit outdated or not complete. It should say that they are not displayed, if the binaries are there. In this case, as Binary: Build it will be displaying them. If Binary: Cache, then they won't be displayed in conan info.

I am moving this to the docs repo to improve that. Thanks for reporting!

KepptnKool commented 4 years ago

Is there a way to disable showing the build dependencies with conan info? Maybe run it twice?

memsharded commented 4 years ago
conan info poco/1.9.4@ --dry-build=never

That will define that we don't want to build things, so it will skip the build-requires.

Even if some things are commanded to be built, you can show the fields you want only:

conan info poco/1.9.4@ --dry-build -n=license