concretizer: make rules on virtual packages more linear
fixes #20679 In this refactor we have a single cardinality rule on the provider, which triggers a rule transforming a dependency on a virtual package into a dependency on the provider of the virtual.
This commit is contained in:
		 Massimiliano Culpo
					Massimiliano Culpo
				
			
				
					committed by
					
						 Tamara Dahlgren
						Tamara Dahlgren
					
				
			
			
				
	
			
			
			 Tamara Dahlgren
						Tamara Dahlgren
					
				
			
						parent
						
							8e442d6dc1
						
					
				
				
					commit
					ddd9c86ce0
				
			| @@ -132,22 +132,21 @@ attr(Name, Arg1, Arg2, Arg3) :- | |||||||
| %----------------------------------------------------------------------------- | %----------------------------------------------------------------------------- | ||||||
| % Virtual dependencies | % Virtual dependencies | ||||||
| %----------------------------------------------------------------------------- | %----------------------------------------------------------------------------- | ||||||
| % if you declare a dependency on a virtual AND the package is not an external, |  | ||||||
| % you depend on one of its providers | % if a package depends on a virtual, it's not external and we have a | ||||||
| 1 { | % provider for that virtual then it depends on the provider | ||||||
|   depends_on(Package, Provider, Type) : possible_provider(Provider, Virtual) | depends_on(Package, Provider, Type) | ||||||
| } 1 |  | ||||||
|   :- dependency_conditions(Package, Virtual, Type), |   :- dependency_conditions(Package, Virtual, Type), | ||||||
|      virtual(Virtual), |      provides_virtual(Provider, Virtual), | ||||||
|      not external(Package). |      not external(Package). | ||||||
|  |  | ||||||
| % if a virtual was required by some package, one provider is in the DAG | % if there's a virtual node, we must select one provider | ||||||
| 1 { node(Package) : provider(Package, Virtual) } 1 | 1 { provides_virtual(Package, Virtual) : possible_provider(Package, Virtual) } 1 | ||||||
|  :- virtual_node(Virtual). |  :- virtual_node(Virtual). | ||||||
|  |  | ||||||
| % virtual roots imply virtual nodes, and that one provider is a root | % virtual roots imply virtual nodes, and that one provider is a root | ||||||
| virtual_node(Virtual) :- virtual_root(Virtual). | virtual_node(Virtual) :- virtual_root(Virtual). | ||||||
| 1 { root(Package) : possible_provider(Package, Virtual) } 1 | 1 { root(Package) : provides_virtual(Package, Virtual) } 1 | ||||||
|   :- virtual_root(Virtual). |   :- virtual_root(Virtual). | ||||||
|  |  | ||||||
| % all virtual providers come from provider conditions like this | % all virtual providers come from provider conditions like this | ||||||
| @@ -174,8 +173,7 @@ virtual_node(Virtual) | |||||||
|      virtual(Virtual), not external(Package). |      virtual(Virtual), not external(Package). | ||||||
|  |  | ||||||
| % for any virtual, there can be at most one provider in the DAG | % for any virtual, there can be at most one provider in the DAG | ||||||
| 0 { provider(Package, Virtual) : | 0 { node(Package) : provides_virtual(Package, Virtual) } 1 :- virtual(Virtual). | ||||||
|     node(Package), provides_virtual(Package, Virtual) } 1 :- virtual(Virtual). |  | ||||||
|  |  | ||||||
| %----------------------------------------------------------------------------- | %----------------------------------------------------------------------------- | ||||||
| % Virtual dependency weights | % Virtual dependency weights | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user