Skip to content

Conversation

@jcar87
Copy link
Contributor

@jcar87 jcar87 commented Mar 26, 2025

Changelog: Omit
Docs: Omit

@memsharded
Copy link
Member

The possible fixes to change this behavior breaks #17643 added a couple of months ago for test_build_order_build_context_compatible() test.

If we change the behavior (it is easy), it might have implications for ConanCenter having missing binaries in the build context?

@jcar87 jcar87 force-pushed the lcc/test/conan-graph-picks-compatible-package-id-in-build-context branch from 6f9346e to 680c1cc Compare April 7, 2025 11:28
@memsharded
Copy link
Member

To keep it for future reference.
If we ever want to change the behavior to require different build in "build" and "host", the change is:

diff --git a/conans/client/graph/graph_binaries.py b/conans/client/graph/graph_binaries.py 
index cc4334bda..43eaf4164 100644                                                          
--- a/conans/client/graph/graph_binaries.py                                                
+++ b/conans/client/graph/graph_binaries.py                                                
@@ -106,7 +106,7 @@ class GraphBinariesAnalyzer:                                           
         exactly the same                                                                  
         """                                                                               
         pref = node.pref                                                                  
-        previous_nodes = self._evaluated.get(pref)                                        
+        previous_nodes = self._evaluated.get((pref, node.context))                        
         if previous_nodes:                                                                
             previous_nodes.append(node)                                                   
             previous_node = previous_nodes[0]                                             
@@ -121,7 +121,7 @@ class GraphBinariesAnalyzer:                                           
             # https://github.com/conan-io/conan/issues/9880                               
             node._package_id = previous_node.package_id                                   
             return True                                                                   
-        self._evaluated[pref] = [node]                                                    
+        self._evaluated[(pref, node.context)] = [node]                                    

@memsharded memsharded merged commit fc75f01 into conan-io:develop2 Apr 7, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants