Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Missing requirements when using package development flow #9321

Closed
gpxricky opened this issue Jul 26, 2021 · 3 comments
Closed

[bug] Missing requirements when using package development flow #9321

gpxricky opened this issue Jul 26, 2021 · 3 comments
Assignees
Milestone

Comments

@gpxricky
Copy link

Hi there,

I'm probably doing something wrong or missing a Conan concept, but I have the following problem and can't image why this should be a "feature":

1.) I have some advanced logic to load requirements from a YAML file, therefore I'm implementing the requirements method
2.) conan install works as expected when using the package development flow
3.) conan build does not work as expected. I was expecting the requirements to be accessible in the self.requires attribute, but it is just empty. It seems the requirements method is not called when using the conan build step. I - of course - can work around that by calling the requirements method again if self.requires is empty, but I don't see any reason why this needs to be done manually by the developer.

I would be very interested in knowing the details why the behavior is as it is or if it is a bug or a feature.

Many thanks for clarification.

Environment Details (include every applicable attribute)

  • Operating System+version: Ubuntu 18.04
  • Compiler+version: -
  • Conan version: 1.38.0
  • Python version: 3.6.9

Steps to reproduce (Include if Applicable)

1.) Load a requirement via the requirements method
2.) Print the content of self.requires during the build method
3.) Use the package development flow
4.) Expected: self.requires contains the requirement that is loaded in the requirements method
5.) Actual: self.requires is empty in the build method

@memsharded
Copy link
Member

Hi @gpxricky

The rationale for this was that conan build had to be very fast, just calling the build command. As the conan install resolution might take some time, what we did in the past was to serialize some necessary information at conan install and conan build just reads it, instead of computing the whole graph. As a result, not all the information is available, just the bare minimum, and this has been the source of some issues, similar to this one in the last years. This was not a bug, the build() method was not supposed to have access to the self.requires, only the generators at "install" time had full access to dependencies information.

So then, we decided to remove this for Conan 2.0. This was discussed with the Tribe here: conan-io/tribe#19

The necessary changes have already been implemented in the develop2 branch, and will be part of the first Conan 2.0-alpha. It will basically compute a full dependency graph for every conan build command, so all the information will be there. So this issue can be considered fixed by #8589

@memsharded memsharded added this to the 2.0 milestone Jul 26, 2021
@gpxricky
Copy link
Author

Thanks @memsharded for the explanation. That makes sense for (or at least explains my issue) and I'm looking forward to Conan 2.0 ;).

@memsharded
Copy link
Member

Good, thanks for telling :)

As #8589 has been merged into develop2, we can close this issue as fixed, and will be released in next Conan 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants