diff --git a/index/alire-index-alire.ads b/index/alire-index-alire.ads index 44eb95c6..eea52a80 100644 --- a/index/alire-index-alire.ads +++ b/index/alire-index-alire.ads @@ -133,31 +133,36 @@ package Alire.Index.Alire is (Operating_System = Windows and Operating_System /= GNU_Linux) or (Compiler = GNAT_Unknown and Compiler /= GNAT_Unknown)); - package Experimental is - - function Project is new Catalogued_Project ("Experimental packages"); - - Base : constant Release := Project.Unreleased; - - package V1 is new Released (Base); - package V2 is new Released (Base); - package V3 is new Released (Base); - - package Greedy_Breaker is - - function Project is new Catalogued_Project - ("Dependency too complex for the greedy solver"); - - R : constant Release := Project.Register - (V ("1"), - No_Origin, - Dependencies => - (V2.This_Version -- This causes V2 to be chosen greedily - or V3.This_Version) -- This will never be attempted - and V3.This_Version); -- And thus this will never be met - - end Greedy_Breaker; - - end Experimental; +-- package Experimental is +-- +-- function Project is new Catalogued_Project ("Experimental packages"); +-- +-- Base : constant Release := Project.Unreleased; +-- +-- package V1 is new Released (Base); +-- package V2 is new Released (Base); +-- package V3 is new Released (Base); +-- +-- package Greedy_Breaker is +-- +-- function Project is new Catalogued_Project +-- ("Dependency too complex for the greedy solver"); +-- +-- R1 : constant Release := Project.Register +-- (V ("1"), +-- No_Origin, +-- Dependencies => +-- (V2.This_Version -- This causes V2 to be chosen greedily +-- or V3.This_Version) -- This will never be attempted +-- and V3.This_Version); -- And thus this will never be met +-- +-- R2 : constant Release := Project.Register +-- (V ("2"), +-- No_Origin, +-- Dependencies => +-- (V1.This_Version or V2.This_Version or V3.This_Version)); +-- end Greedy_Breaker; +-- +-- end Experimental; end Alire.Index.Alire; diff --git a/src/alire-conditional_values.adb b/src/alire-conditional_values.adb index 95676910..2d5ad5b9 100644 --- a/src/alire-conditional_values.adb +++ b/src/alire-conditional_values.adb @@ -2,9 +2,16 @@ with GNAT.IO; package body Alire.Conditional_Values is - ------------- - -- Flatten -- - ------------- + function All_But_First_Children (This : Conditional_Value) return Conditional_Value is + Children : Vectors.Vector := This.As_Vector; + begin + Children.Delete_First; + return To_Holder (Vector_Inner'(This.Conjunction, Children)); + end All_But_First_Children; + + ------------- + -- Flatten -- + ------------- procedure Flatten (Inner : in out Vector_Inner; -- The resulting vector This : Inner_Node'Class; -- The next node to flatten diff --git a/src/alire-conditional_values.ads b/src/alire-conditional_values.ads index c0f34640..1cb42e7e 100644 --- a/src/alire-conditional_values.ads +++ b/src/alire-conditional_values.ads @@ -83,6 +83,12 @@ package Alire.Conditional_Values with Preelaborate is Visitor : access procedure (CV : Conditional_Value)); -- There is "of" notation too, but that bugs out when using this package as generic formal + type Children_Array is array (Positive range <>) of Conditional_Value; + + function First_Child (This : Conditional_Value) return Conditional_Value; + + function All_But_First_Children (This : Conditional_Value) return Conditional_Value; + -------------------- -- CONDITIONALS -- -------------------- @@ -174,7 +180,7 @@ private end record; function Conjunction (This : Vector_Inner) return Conjunctions is - (This.Conjunction); + (This.Conjunction); package Non_Primitive is function One_Liner_And is new Utils.Image_One_Line @@ -193,9 +199,9 @@ private end Non_Primitive; overriding function Image (V : Vector_Inner) return String is - (if V.Conjunction = Anded - then Non_Primitive.One_Liner_And (V.Values) - else Non_Primitive.One_Liner_Or (V.Values)); + ("(" & (if V.Conjunction = Anded + then Non_Primitive.One_Liner_And (V.Values) + else Non_Primitive.One_Liner_Or (V.Values)) & ")"); type Conditional_Inner is new Inner_Node with record Condition : Requisites.Tree; @@ -238,7 +244,14 @@ private ----------------- function Conjunction (This : Conditional_Value) return Conjunctions is - (Vector_Inner'Class (This.Element).Conjunction); + (Vector_Inner'Class (This.Element).Conjunction); + + ----------------- + -- First_Child -- + ----------------- + + function First_Child (This : Conditional_Value) return Conditional_Value is + (To_Holder (This.As_Vector.First_Element)); --------------------- -- New_Conditional -- diff --git a/src/alire-containers.adb b/src/alire-containers.adb index d6ee436f..ae826904 100644 --- a/src/alire-containers.adb +++ b/src/alire-containers.adb @@ -24,6 +24,9 @@ package body Alire.Containers is end return; end Inserting; + function Inserting (Dst : Release_Map; Src : Releases.Release) return Release_Map is + (Dst.Inserting (To_Map (Src))); + --------------- -- Excluding -- --------------- diff --git a/src/alire-containers.ads b/src/alire-containers.ads index 7fcf0f35..31135b9b 100644 --- a/src/alire-containers.ads +++ b/src/alire-containers.ads @@ -53,6 +53,8 @@ package Alire.Containers with Preelaborate is function Inserting (Dst : Release_Map; Src : Release_Map) return Release_Map; + function Inserting (Dst : Release_Map; Src : Releases.release) return Release_Map; + function To_Dependencies (Map : Release_Map) return Conditional.Dependencies; diff --git a/src/alire-releases.ads b/src/alire-releases.ads index 5c4ba910..6a7632e1 100644 --- a/src/alire-releases.ads +++ b/src/alire-releases.ads @@ -2,8 +2,7 @@ with Ada.Tags; with Alire.Actions; with Alire.Conditional; --- with Alire.Dependencies; --- with Alire.Dependencies.Vectors; +with Alire.Dependencies; with Alire.Milestones; with Alire.Origins; with Alire.Properties; @@ -134,6 +133,9 @@ package Alire.Releases with Preelaborate is function Property_Contains (R : Release; Str : String) return Boolean; -- True if some property contains the given string + function Satisfies (R : Release; Dep : Dependencies.Dependency) return Boolean; + -- Ascertain if this release is a valid candidate for Dep + private use Semantic_Versioning; @@ -213,6 +215,10 @@ private else R.Origin.Commit (R.Origin.Commit'First .. R.Origin.Commit'First + 7)))); function On_Platform_Actions (R : Release; P : Properties.Vector) return Properties.Vector is - (R.On_Platform_Properties (P, Actions.Action'Tag)); + (R.On_Platform_Properties (P, Actions.Action'Tag)); + + function Satisfies (R : Release; Dep : Dependencies.Dependency) return Boolean is + (R.Project = Dep.Project and then + Satisfies (R.Version, Dep.Versions)); end Alire.Releases; diff --git a/src/alire-types.ads b/src/alire-types.ads index 1d078044..6787aa79 100644 --- a/src/alire-types.ads +++ b/src/alire-types.ads @@ -3,6 +3,8 @@ with Alire.Dependencies; -- with Alire.Dependencies.Vectors; with Alire.Releases; +with Semantic_Versioning; + package Alire.Types with Preelaborate is -- Recopilation of types for convenient use and documentation @@ -20,6 +22,11 @@ package Alire.Types with Preelaborate is function No_Dependencies return Conditional.Dependencies renames Conditional.For_Dependencies.Empty; + function New_Dependency (Name : Alire.Project; + Versions : Semantic_Versioning.Version_Set) + return Platform_Dependencies + renames Conditional.New_Dependency; + subtype Release is Releases.Release; -- A catalogued release