Versions matching upstream, "or" dependencies
Also: explicit Unavailable dependency
This commit is contained in:
@@ -13,28 +13,28 @@ package Alire.Index.Adacurses is
|
||||
|
||||
V_6 : constant Release :=
|
||||
Project.Register
|
||||
(V ("6.0+20170708-2"),
|
||||
(V ("6"),
|
||||
Git (Repo, "4ccb20409becb50c0b5fd29effb676b650608326"),
|
||||
|
||||
Dependencies =>
|
||||
On_Condition
|
||||
(Distribution = Debian or Distribution = Ubuntu,
|
||||
When_True => When_Available (NcursesAda.V_5.Within_Major),
|
||||
When_True => When_Available (NcursesAda.V_6.Within_Major),
|
||||
When_False => Unavailable),
|
||||
|
||||
Properties =>
|
||||
Comments
|
||||
);
|
||||
|
||||
V_5_9 : constant Release :=
|
||||
V_5 : constant Release :=
|
||||
Project.Register
|
||||
(V ("5.9+20140726-1build1"),
|
||||
(V ("5"),
|
||||
Git (Repo, "4ccb20409becb50c0b5fd29effb676b650608326"),
|
||||
|
||||
Dependencies =>
|
||||
On_Condition
|
||||
(Distribution = Debian or Distribution = Ubuntu,
|
||||
When_True => When_Available (NcursesAda.V_3.Within_Major),
|
||||
When_True => When_Available (NcursesAda.V_5.Within_Major),
|
||||
When_False => Unavailable),
|
||||
|
||||
Properties =>
|
||||
|
||||
@@ -28,8 +28,9 @@ package Alire.Index.Alire is
|
||||
Elite_Dangerous,
|
||||
Half_Life_3,
|
||||
Star_Citizen,
|
||||
Windows_100 : Catalog_Entry;
|
||||
Windows_100 : Catalog_Entry := Example_Project;
|
||||
-- A few fake release to spice descriptions a bit up.
|
||||
-- Although they're seen as "Alire" in textual dumps
|
||||
|
||||
Syntax_Example : constant Release :=
|
||||
Example_Project.Register
|
||||
@@ -43,13 +44,13 @@ package Alire.Index.Alire is
|
||||
When_True => Elite_Dangerous >= "2.0" and Star_Citizen >= V ("3.0"), -- Wish...
|
||||
When_False => Windows_100 > V ("1.0")) and
|
||||
When_Available -- Chained preferences
|
||||
(Preferred => Within_Major (Alire.Project, V ("1.0")), -- as function
|
||||
Otherwise => Alire.Project.Within_Major (V ("0.0"))) and -- or dot notation
|
||||
(Preferred => Within_Major (Alire.Project, V ("1.0"))) and -- or dot notation
|
||||
When_Available -- Chained preferences
|
||||
(Preferred => Alire.Project.Within_Major ("2.0"),
|
||||
Otherwise => When_Available -- Chained preferences multi-level
|
||||
(Preferred => Within_Major (Alire.Project, V ("1.0")),
|
||||
Otherwise => Alire.Project.Within_Major ("0.5"))), -- V () is optional
|
||||
Otherwise => Alire.Project.Within_Major ("0.5"))) and -- V () is optional
|
||||
(Star_Citizen >= "4.0" or Half_Life_3 >= "1.0"), -- Chained preferences, takes first
|
||||
|
||||
Private_Properties => -- These are only interesting to alr, not users
|
||||
GPR_External ("Profile", "False"),
|
||||
|
||||
@@ -14,7 +14,7 @@ package Alire.Index.Eagle_Lander is
|
||||
Git (Prj_Repo, "5a3bcc61eff4d60d2b741add7841410ce539d0b8"),
|
||||
|
||||
Dependencies =>
|
||||
GtkAda.V_16_1.Within_Major,
|
||||
GtkAda.V_17.Within_Major,
|
||||
|
||||
Properties =>
|
||||
Project_File ("lunar_lander.gpr") and
|
||||
|
||||
@@ -18,7 +18,7 @@ package Alire.Index.Steamsky is
|
||||
Notes => "GtkAda version",
|
||||
|
||||
Dependencies =>
|
||||
GtkAda.V_16_1.Within_Major,
|
||||
GtkAda.V_17.Within_Major,
|
||||
|
||||
Properties =>
|
||||
Author (Prj_Author) and
|
||||
|
||||
@@ -4,9 +4,9 @@ package Alire.Index.GtkAda is
|
||||
|
||||
function Project is new Catalogued_Project (Projects.GtkAda);
|
||||
|
||||
V_16_1 : constant Release :=
|
||||
V_17 : constant Release :=
|
||||
Project.Register
|
||||
(V ("16.1"),
|
||||
(V ("17"),
|
||||
Native ((Debian | Ubuntu => Packaged_As ("libgtkada16.1.0-dev"),
|
||||
others => Unavailable)),
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ package Alire.Index.NcursesAda is
|
||||
|
||||
function Project is new Catalogued_Project (Projects.NcursesAda);
|
||||
|
||||
V_5 : constant Release :=
|
||||
V_6 : constant Release :=
|
||||
Project.Register
|
||||
(V ("5.0.0+6.0.20170708-2"),
|
||||
(V ("6"),
|
||||
Native ((Debian | Ubuntu => Packaged_As ("libncursesada5-dev"),
|
||||
others => Unavailable)),
|
||||
|
||||
@@ -14,9 +14,9 @@ package Alire.Index.NcursesAda is
|
||||
Compiler_Is_Native
|
||||
);
|
||||
|
||||
V_3 : constant Release :=
|
||||
V_5 : constant Release :=
|
||||
Project.Register
|
||||
(V ("3.0.0+5.9.20140726-1build1"),
|
||||
(V ("5"),
|
||||
Native ((Debian | Ubuntu => Packaged_As ("libncursesada3-dev"),
|
||||
others => Unavailable)),
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ private
|
||||
|
||||
function New_Dependency (Name : Names;
|
||||
Versions : Semantic_Versioning.Version_Set) return Vector is
|
||||
(To_Vector ((Name, To_Holder (Versions)), 1));
|
||||
(To_Vector ((Name, Versions), 1));
|
||||
|
||||
--------------------
|
||||
-- Image_One_Line --
|
||||
|
||||
+17
-13
@@ -1,5 +1,3 @@
|
||||
private with Ada.Containers.Indefinite_Holders;
|
||||
|
||||
limited with Alire.Dependencies.Vectors;
|
||||
|
||||
with Alire.Projects;
|
||||
@@ -27,31 +25,37 @@ package Alire.Dependencies with Preelaborate is
|
||||
subtype Vector is Dependencies.Vectors.Vector;
|
||||
-- Thanks to limited with -- amazing
|
||||
|
||||
function Unavailable return Dependency;
|
||||
-- Special never available dependency to beautify a bit textual outputs
|
||||
|
||||
private
|
||||
|
||||
use all type Semantic_Versioning.Version;
|
||||
|
||||
package Version_Holders is new Ada.Containers.Indefinite_Holders
|
||||
(Semantic_Versioning.Version_Set, Semantic_Versioning."=");
|
||||
|
||||
type Version_Set_Holder is new Version_Holders.Holder with null record;
|
||||
|
||||
type Dependency is tagged record
|
||||
Project : Projects.Names;
|
||||
Versions_H : Version_Set_holder;
|
||||
Versions : Semantic_Versioning.Version_Set;
|
||||
end record;
|
||||
|
||||
function New_Dependency (Name : Names;
|
||||
Versions : Semantic_Versioning.Version_Set) return Dependency
|
||||
is ((Name, To_Holder (Versions)));
|
||||
is (Name, Versions);
|
||||
|
||||
function Project (Dep : Dependency) return Names is (Dep.Project);
|
||||
|
||||
function Versions (Dep : Dependency) return Semantic_Versioning.Version_Set is
|
||||
(Dep.Versions_H.Element);
|
||||
(Dep.Versions);
|
||||
|
||||
function Image (Dep : Dependency) return String is
|
||||
(Utils.To_Lower_Case (Dep.Project'Img) & " is " &
|
||||
Semantic_Versioning.Image (Dep.Versions_H.Element));
|
||||
use all type Projects.Names;
|
||||
|
||||
function Image (Dep : Dependency) return String is -- Exceptional case: alire=0.0.0 means Unavailable
|
||||
(if Dep.Project = Projects.Alire and then Semantic_Versioning.Satisfies (V ("0"), Dep.Versions)
|
||||
then "Unavailable"
|
||||
else
|
||||
(Utils.To_Lower_Case (Dep.Project'Img) & " is " &
|
||||
Semantic_Versioning.Image (Dep.Versions)));
|
||||
|
||||
function Unavailable return Dependency is
|
||||
(New_Dependency (Projects.Alire, Semantic_Versioning.Exactly (Semantic_Versioning.V ("0"))));
|
||||
|
||||
end Alire.Dependencies;
|
||||
|
||||
@@ -133,6 +133,37 @@ package body Alire.Index is
|
||||
end return;
|
||||
end Register;
|
||||
|
||||
------------
|
||||
-- Bypass --
|
||||
------------
|
||||
|
||||
function Bypass (-- Mandatory
|
||||
Project : Catalog_Entry;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Origin : Origins.Origin;
|
||||
-- we force naming beyond this point with this ugly guard:
|
||||
XXXXXXXXXXXXXX : Utils.XXX_XXX := Utils.XXX_XXX_XXX;
|
||||
-- Optional
|
||||
Notes : Description_String := "";
|
||||
Dependencies : Release_Dependencies := No_Dependencies;
|
||||
Properties : Release_Properties := No_Properties;
|
||||
Private_Properties : Release_Properties := No_Properties;
|
||||
Available_When : Release_Requisites := No_Requisites)
|
||||
return Release
|
||||
is
|
||||
pragma Unreferenced (XXXXXXXXXXXXXX);
|
||||
begin
|
||||
return
|
||||
Alire.Releases.New_Release (Project.Name,
|
||||
Version,
|
||||
Origin,
|
||||
Notes,
|
||||
Dependencies,
|
||||
Properties => Properties,
|
||||
Private_Properties => Private_Properties,
|
||||
Available => Available_When);
|
||||
end Bypass;
|
||||
|
||||
---------------
|
||||
-- To_Native --
|
||||
---------------
|
||||
|
||||
+20
-2
@@ -31,7 +31,7 @@ package Alire.Index is
|
||||
|
||||
Catalog : Containers.Release_Set;
|
||||
|
||||
type Catalog_Entry is new Versions.Comparable with private;
|
||||
type Catalog_Entry (<>) is new Versions.Comparable with private;
|
||||
|
||||
function Name (C : Catalog_Entry) return Projects.Names;
|
||||
|
||||
@@ -82,6 +82,21 @@ package Alire.Index is
|
||||
return Release;
|
||||
-- Properties are generally interesting to the user
|
||||
-- Private_Properties are only interesting to alr
|
||||
|
||||
function Bypass (-- Mandatory
|
||||
Project : Catalog_Entry;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Origin : Origins.Origin;
|
||||
-- we force naming beyond this point with this ugly guard:
|
||||
XXXXXXXXXXXXXX : Utils.XXX_XXX := Utils.XXX_XXX_XXX;
|
||||
-- Optional
|
||||
Notes : Description_String := "";
|
||||
Dependencies : Release_Dependencies := No_Dependencies;
|
||||
Properties : Release_Properties := No_Properties;
|
||||
Private_Properties : Release_Properties := No_Properties;
|
||||
Available_When : Release_Requisites := No_Requisites)
|
||||
return Release;
|
||||
-- Does nothing: used for some examples and available to quickly retire a release (!)
|
||||
|
||||
subtype Platform_Independent_Path is String with Dynamic_Predicate =>
|
||||
(for all C of Platform_Independent_Path => C /= '\');
|
||||
@@ -181,6 +196,9 @@ package Alire.Index is
|
||||
Otherwise));
|
||||
-- Chained conditional dependencies (use first available)
|
||||
|
||||
function "or" (L, R : Release_Dependencies) return Release_Dependencies is (When_Available (L, R));
|
||||
-- In the sense of "or else": the first one that is resolvable will be taken
|
||||
|
||||
function "and" (L, R : Release_Dependencies) return Release_Dependencies
|
||||
renames Conditional.For_Dependencies."and";
|
||||
|
||||
@@ -339,6 +357,6 @@ private
|
||||
|
||||
function Unavailable return Conditional.Dependencies is
|
||||
(Conditional.For_Dependencies.New_Value -- A conditional (without condition) dependency vector
|
||||
(Dependencies.Vectors.New_Dependency (Projects.Alire, Semver.At_Most (Semver.V ("0.0")))));
|
||||
(Dependencies.Vectors.To_Vector (Dependencies.Unavailable, 1)));
|
||||
|
||||
end Alire.Index;
|
||||
|
||||
Reference in New Issue
Block a user