question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] Dependencies' build_policy overwrites command line parameter

See original GitHub issue

We recently encountered an issue with our CI system, when incorrectly configured dependency packages were rebuilt in a CI step, where we didn’t allow it via --build=never.

Environment Details

  • Operating System+version: Windows 10
  • Conan version: 1.22.0 and 1.23.0
  • Python version: 3.6.4

Steps to reproduce

a/conanfile.py

from conans import ConanFile

class TestA(ConanFile):
  name = "TestA"
  version = "1.0"
  requires = "TestB/1.0@test/test"

  def build(self):
    self.output.info("Build TestA")

b/conanfile.py

from conans import ConanFile

class TestB(ConanFile):
  name = "TestB"
  version = "1.0"
  build_policy = "missing" # !!!

  def build(self):
    self.output.info("Build TestB")
  1. Create packages TestA and TestB
    conan create b test/test
    conan create a test/test
    
  2. Remove package TestB and reexport the conanfile
    conan remove TestB
    conan export b test/test
    
  3. Install TestA without build
    conan install TestA/1.0@test/test --build=never
    

Expected behavior:

Install command should fail, since TestB is not installed and --build=never is specified.

Actual behavior:

Install command succeeds and TestB is rebuilt (see log).

Remark: The same bug occurs when setting build_policy=always in b/conanfile.py. You can then skip step 2 and specify --build=missing in step 3, then TestB will be rebuilt although it shouldn’t.

Logs

Log for step 3:

PS E:\Workspace\conan_bug> conan install TestA/1.0@test/test --build=never
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=15
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

TestB/1.0@test/test: Building package from source as defined by build_policy='missing'
Installing package: TestA/1.0@test/test
Requirements
    TestA/1.0@test/test from local cache - Cache
    TestB/1.0@test/test from local cache - Cache
Packages
    TestA/1.0@test/test:5c07eea89709163d6f80759ede846381d3745442 - Cache
    TestB/1.0@test/test:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Build

Installing (downloading, building) binaries...
TestB/1.0@test/test: Configuring sources in C:\Users\Oliver\.conan\data\TestB\1.0\test\test\source
TestB/1.0@test/test: Copying sources to build folder
TestB/1.0@test/test: Building your package in C:\Users\Oliver\.conan\data\TestB\1.0\test\test\build\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
TestB/1.0@test/test: Generator txt created conanbuildinfo.txt
TestB/1.0@test/test: Calling build()
TestB/1.0@test/test: Build TestB
TestB/1.0@test/test: Package '5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9' built
TestB/1.0@test/test: Build folder C:\Users\Oliver\.conan\data\TestB\1.0\test\test\build\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
TestB/1.0@test/test: Generated conaninfo.txt
TestB/1.0@test/test: Generated conanbuildinfo.txt
TestB/1.0@test/test: Generating the package
TestB/1.0@test/test: Package folder C:\Users\Oliver\.conan\data\TestB\1.0\test\test\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
TestB/1.0@test/test: Calling package()
TestB/1.0@test/test: WARN: This conanfile has no package step
TestB/1.0@test/test package(): WARN: No files in this package!
TestB/1.0@test/test: Package '5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9' created
TestB/1.0@test/test: Created package revision 4d0ed6b951018d8af295b25c8922813c
TestA/1.0@test/test: Already installed!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
memshardedcommented, Mar 11, 2020

Hi, are you intending to keep this behavior for Conan 2.0?

We are considering removing these policies for Conan 2.0, or at least redefine their behavior.

The use cases are for example: a driver, that needs to be built from sources always in the target machine. Only the recipe is uploaded, but it is a bit annoying to always fail when users do install them (maybe even transitively, they are not aware of this driver). Having it in the profile is still on the consumer side, they will still fail, realize they need to build that, add it to their profiles, so a bit inconvenient too. But might be more explicit, and then more aligned with general conan design.

Lets annotate this for Conan 2.0 review.

0reactions
czoidocommented, Dec 21, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Gradle command line arguments to override properties in ...
Put in your gradle.properties default value: SDK_VERSION=26. Use in build.gradle : android { compileSdkVersion project.
Read more >
conan info — conan 1.53.0 documentation
Gets information about the dependency graph of a recipe. ... in an install command specifying a build policy with the --build parameter.
Read more >
Allure Framework
Allure Framework is a flexible lightweight multi-language test report tool that not only shows a very concise representation of what have ...
Read more >
Rules | Bazel
It is an error if there is a cycle in the dependency graph of targets. ... libraries, parameters to pass on a tool's...
Read more >
makefile_ccase - IBM
Both targets and dependencies may contain ClearCase path name patterns. ... The command-line option –i suppresses termination-on-error for all command lines ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found