Version + Arch properties

This commit is contained in:
Alejandro R. Mosteo
2018-03-03 02:35:05 +01:00
parent e7f039156c
commit dfb3191b3a
9 changed files with 137 additions and 122 deletions
+11 -77
View File
@@ -1,89 +1,23 @@
with Alire.Platforms;
with Alire.Properties.Platform;
with Alire.Utils;
package Alire.Requisites.Platform with Preelaborate is
function Compiler_Is_At_Least (V : Platforms.Compilers) return Requisites.Tree;
package Plat renames Properties.Platform;
function Distribution_Is (V : Platforms.Distributions) return Requisites.Tree;
package Compilers is new Typed_Value_Requisites (Plat.Compilers, "Compiler");
function Compiler_Is (V : Platforms.Compilers) return Tree renames Compilers.New_Equality;
function System_Is (V : Platforms.Operating_Systems) return Requisites.Tree;
package Distributions is new Typed_Value_Requisites (Plat.Distributions, "Distribution");
function Distribution_Is (V : Platforms.Distributions) return Tree renames Distributions.New_Equality;
private
package Systems is new Typed_Value_Requisites (Plat.Operating_Systems, "OS");
function System_Is (V : Platforms.Operating_Systems) return Tree renames Systems.New_Equality;
-- Preparation for OS requisites mimicking OS properties
package Versions is new Typed_Value_Requisites (Plat.Versions, "Version");
function Version_Is (V : Platforms.Versions) return Tree renames Versions.New_Equality;
use all type Platforms.Compilers;
use all type Platforms.Distributions;
use all type Platforms.Operating_Systems;
package Props renames Alire.Properties.Platform;
package System_Requisites is new Typed_Requisites (Props.Operating_Systems.Property'Class);
function Mix (S : String) return String renames Utils.To_Mixed_Case;
type OS_Requisite is new System_Requisites.Requisite with record
Value : Platforms.Operating_Systems;
end record;
overriding function Image (R : OS_Requisite) return String is
("OS is " & Mix (R.Value'Image));
overriding function Is_Satisfied (R : OS_Requisite;
P : Props.Operating_Systems.Property'Class) return Boolean is
(R.Value = P.Element);
package Compiler_Requisites is new Typed_Requisites (Props.Compilers.Property'Class);
type Compiler_Requisite is new Compiler_Requisites.Requisite with record
Value : Platforms.Compilers;
end record;
overriding function Image (R : Compiler_Requisite) return String is
("Compiler >= " & Mix (R.Value'Image));
overriding function Is_Satisfied (R : Compiler_Requisite;
P : Props.Compilers.Property'Class) return Boolean is
(R.Value <= P.Element);
package Distro_Requisites is new Typed_Requisites (Props.Distributions.Property'Class);
type Distro_Requisite is new Distro_Requisites.Requisite with record
Value : Platforms.Distributions;
end record;
overriding function Image (R : Distro_Requisite) return String is
("Distribution is " & Mix (R.Value'Image));
overriding function Is_Satisfied (R : Distro_Requisite;
P : Props.Distributions.Property'Class) return Boolean is
(R.Value = P.Element);
use all type Tree;
--------------------------
-- Compiler_Is_At_Least --
--------------------------
function Compiler_Is_At_Least (V : Platforms.Compilers) return Requisites.Tree is
(+Compiler_Requisite'(Value => V));
---------------------
-- Distribution_Is --
---------------------
function Distribution_Is (V : Platforms.Distributions) return Requisites.Tree is
(+Distro_Requisite'(Value => V));
---------------
-- System_Is --
---------------
function System_Is (V : Platforms.Operating_Systems) return Requisites.Tree is
(+OS_Requisite'(Value => V));
package Word_Sizes is new Typed_Value_Requisites (Plat.Word_Sizes, "Arquitecture width");
function Word_Size_Is (V : Platforms.Word_Sizes) return Tree renames Word_Sizes.New_Equality;
end Alire.Requisites.Platform;