Closed SaarYogev closed 1 month ago
Hi @SaarYogev
Thanks for your feedback.
This is not a bug, this is by design. Let me try to clarify how Conan works:
package_id
of every package in the dependency graph is computed. This package_id
is the representation of the necessary binary. The specific versions of dependencies do affect the consumers of the packages, so it is first necessary to know the dependencies versions (fully expand the graph) to be able to compute which binary is necessary for each node in the dependency graphpackage_id
is analyzed, checking if it does exist, if is necessary to build it, if it is an invalid configuration for the current platform, or if it is existing in a server and it has to be downloadedpackage_id
binary in the graph is downloaded, built from source, etc.Searching for a joint compatible set of existing binaries for previous versions and recipe revisions makes this problem NP complete, requiring backtracking. Every time a binary package_id
is not found, the full dependency upstream graph should be invalidated and rebuilt again for the new considered version or revision. Taking into account that evaluating hypothesis in this necessary backtracking algorithm involves things as downloading files, unzipping them, loading and python-parsing them and finally executing them, this makes this problem intractable in practice. Trying to do so could result in non tolerable graph resolution times (I am talking about many hours).
The way to approach this in Conan is with different versioning and devops practices:
prereleases
in requires
in recipes, but activate it via conf
only)Hi @SaarYogev
Any further question here? Thanks for your feedback.
No more questions, thank you! I changed the code I our CI to work with this, so each pipeline will create packages with all the possible configurations our users might ask for.
Thanks for your feedback! Closing the ticket then.
Do not hesitate to create new tickets if you have any further question or issue.
Describe the bug
Environment Details:
Description
I'm trying to install the latest package (let's call it
A
) with the relevant settings and options, such as Debug build_type. To do that, I'm callingconan install --requires="A/[~1,include_prerelease]" -s build_type=Debug
. What I expect to get is the package I uploaded that has the Debug build_type. What I get instead is a random version of A, that has a Release build_type, asgraph explain
tells me.I debugged a bit, and saw the Conan only filtered the package based on the name and version pattern, and left the filtering based on settings and option until after the package candidate is selected. As you can see in
range_resolver.py:60
, there are no options/settings even passed, only a (version) pattern.Another way in which I found it's an issue with the filtering, and not recognizing the package itself, is that Conan successfully installs the correct package if I restrict the version pattern to include only packages which include the settings and options I want.
As far as I know this is not a well known or documented behaviour, and I think it should be changed, so packages are filtered based on settings and options in addition to the version pattern, and only then the latest package is selected for the graph.
My use case
I'll explain my use case here, so if you think you can there's a better way to achieve what I need without changing Conan, I am open to suggestions 😄 .
There are two reasons that each version does not include every possible setting/option combination: 1.I tag prerelease versions based on a timestamp, so developers working on a feature would get a package automatically, without tagging it by hand. The timestamp also keeps it ordered, as I'm allowed to order by prerelease information according to the semantic versioning spec. Since release and debug configurations don't get at the exact same time, each prerelease version only has one of them, and I expect to just get the latest prerelease version using release or debug based on my request.
I appreciate your help and attention to this matter, thank you!
How to reproduce it
conan install --requires="A/[~1,include_prerelease]" -s build_type=Debug
conan graph explain --requires="A/[~1,include_prerelease]" -s build_type=Debug
says the closest binary has a Release build_type.