Native releases support
This commit is contained in:
Vendored
+1
-1
Submodule deps/semver updated: 92af9d62a2...d21d7c014e
+4
-2
@@ -8,7 +8,8 @@ package body Alire.Index is
|
||||
Version : Semantic_Versioning.Version;
|
||||
Hosting : Repositories.Repository'Class;
|
||||
Id : Repositories.Release_Id;
|
||||
Depends_On : Dependencies := Nothing) return Release
|
||||
Depends_On : Dependencies := Nothing;
|
||||
Native : Boolean := False) return Release
|
||||
is
|
||||
begin
|
||||
return Rel : constant Alire.Releases.Release :=
|
||||
@@ -16,7 +17,8 @@ package body Alire.Index is
|
||||
Version,
|
||||
Hosting,
|
||||
Id,
|
||||
Depends_On)
|
||||
Depends_On,
|
||||
Native => Native)
|
||||
do
|
||||
if Releases.Contains (Rel) then
|
||||
Log ("Attempt to register duplicate versions: " & Rel.Milestone_Image, Warning);
|
||||
|
||||
+51
-66
@@ -5,131 +5,116 @@ with Alire.Repositories.Git;
|
||||
|
||||
with Semantic_Versioning;
|
||||
|
||||
package Alire.Index is
|
||||
|
||||
package Alire.Index is
|
||||
|
||||
Releases : Containers.Release_Set;
|
||||
|
||||
|
||||
subtype Dependencies is Depends.Dependencies;
|
||||
use all type Dependencies;
|
||||
|
||||
|
||||
subtype Release is Alire.Releases.Release;
|
||||
|
||||
|
||||
subtype Solution is Containers.Version_Map; -- A dependence-valid mapping of project -> version
|
||||
subtype Instance is Containers.Release_Map; -- A list of releases complying with a Solution
|
||||
|
||||
|
||||
Empty_Instance : constant Instance := Containers.Project_Release_Maps.Empty_Map;
|
||||
|
||||
function V (Semantic_Version : String) return Semantic_Versioning.Version
|
||||
|
||||
function V (Semantic_Version : String) return Semantic_Versioning.Version
|
||||
renames Semantic_Versioning.New_Version;
|
||||
|
||||
function Register (Project : Project_Name;
|
||||
|
||||
function Register (Project : Project_Name;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Hosting : Repositories.Repository'Class;
|
||||
Id : Repositories.Release_Id;
|
||||
Depends_On : Dependencies := Depends.Nothing) return Release;
|
||||
|
||||
function Register_Git (Project : Project_Name;
|
||||
Depends_On : Dependencies := Depends.Nothing;
|
||||
Native : Boolean := False) return Release;
|
||||
|
||||
function Register_Git (Project : Project_Name;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Hosting : URL;
|
||||
Commit : Repositories.Git.Commit_ID;
|
||||
Depends_On : Dependencies := Depends.Nothing) return Release;
|
||||
|
||||
-- function Register_Local (Project : Project_Name;
|
||||
-- Version : Semantic_Versioning.Version;
|
||||
-- Depends_On : Dependencies := Depends.Nothing;
|
||||
-- License : Licenses := Unknown) return Release;
|
||||
|
||||
Commit : Repositories.Git.Commit_ID;
|
||||
Depends_On : Dependencies := Depends.Nothing) return Release;
|
||||
|
||||
-- Shortcuts to give dependencies:
|
||||
|
||||
|
||||
function At_Least_Within_Major (R : Release) return Dependencies;
|
||||
|
||||
|
||||
function At_Least (R : Release) return Dependencies;
|
||||
function At_Most (R : Release) return Dependencies;
|
||||
function Less_Than (R : Release) return Dependencies;
|
||||
function More_Than (R : Release) return Dependencies;
|
||||
function Exactly (R : Release) return Dependencies;
|
||||
function Except (R : Release) return Dependencies;
|
||||
|
||||
|
||||
subtype Version is Semantic_Versioning.Version;
|
||||
subtype Version_Set is Semantic_Versioning.Version_Set;
|
||||
|
||||
|
||||
function At_Least_Within_Major (P : Project_Name; V : Version) return Dependencies;
|
||||
|
||||
|
||||
function At_Least (P : Project_Name; V : Version) return Dependencies;
|
||||
function At_Most (P : Project_Name; V : Version) return Dependencies;
|
||||
function Less_Than (P : Project_Name; V : Version) return Dependencies;
|
||||
function More_Than (P : Project_Name; V : Version) return Dependencies;
|
||||
function Exactly (P : Project_Name; V : Version) return Dependencies;
|
||||
function Except (P : Project_Name; V : Version) return Dependencies;
|
||||
|
||||
|
||||
private
|
||||
|
||||
function Register_Git (Project : Project_Name;
|
||||
|
||||
function Register_Git (Project : Project_Name;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Hosting : URL;
|
||||
Commit : Repositories.Git.Commit_ID;
|
||||
Commit : Repositories.Git.Commit_ID;
|
||||
Depends_On : Dependencies := Depends.Nothing) return Release
|
||||
is (Register (Project,
|
||||
Version,
|
||||
Repositories.Git.New_Repository (String (Hosting)),
|
||||
Repositories.Release_Id (Commit),
|
||||
Depends_On));
|
||||
|
||||
-- function Register_Local (Project : Project_Name;
|
||||
-- Version : Semantic_Versioning.Version;
|
||||
-- Depends_On : Dependencies := Depends.Nothing;
|
||||
-- License : Licenses := Unknown) return Release is
|
||||
-- (Register (Project,
|
||||
-- Version,
|
||||
-- Repositories.Local.Repo,
|
||||
-- "filesystem",
|
||||
-- Depends_On,
|
||||
-- License));
|
||||
|
||||
Depends_On,
|
||||
Native => False));
|
||||
|
||||
use Depends;
|
||||
use Semantic_Versioning;
|
||||
|
||||
function At_Least_Within_Major (R : Release) return Dependencies is
|
||||
use Semantic_Versioning;
|
||||
|
||||
function At_Least_Within_Major (R : Release) return Dependencies is
|
||||
(New_Dependency (R.Project, At_Least_Within_Major (R.Version)));
|
||||
|
||||
function At_Least (R : Release) return Dependencies is
|
||||
|
||||
function At_Least (R : Release) return Dependencies is
|
||||
(New_Dependency (R.Project, At_Least (R.Version)));
|
||||
|
||||
function At_Most (R : Release) return Dependencies is
|
||||
|
||||
function At_Most (R : Release) return Dependencies is
|
||||
(New_Dependency (R.Project, At_Most (R.Version)));
|
||||
|
||||
function Less_Than (R : Release) return Dependencies is
|
||||
|
||||
function Less_Than (R : Release) return Dependencies is
|
||||
(New_Dependency (R.Project, Less_Than (R.Version)));
|
||||
|
||||
function More_Than (R : Release) return Dependencies is
|
||||
|
||||
function More_Than (R : Release) return Dependencies is
|
||||
(New_Dependency (R.Project, More_Than (R.Version)));
|
||||
|
||||
function Exactly (R : Release) return Dependencies is
|
||||
|
||||
function Exactly (R : Release) return Dependencies is
|
||||
(New_Dependency (R.Project, Exactly (R.Version)));
|
||||
|
||||
function Except (R : Release) return Dependencies is
|
||||
|
||||
function Except (R : Release) return Dependencies is
|
||||
(New_Dependency (R.Project, Except (R.Version)));
|
||||
|
||||
|
||||
|
||||
|
||||
function At_Least_Within_Major (P : Project_Name; V : Version) return Dependencies is
|
||||
(Depends_On (P, At_Least_Within_Major (V)));
|
||||
|
||||
|
||||
function At_Least (P : Project_Name; V : Version) return Dependencies is
|
||||
(Depends_On (P, At_Least (V)));
|
||||
|
||||
|
||||
function At_Most (P : Project_Name; V : Version) return Dependencies is
|
||||
(Depends_On (P, At_Most (V)));
|
||||
|
||||
|
||||
function Less_Than (P : Project_Name; V : Version) return Dependencies is
|
||||
(Depends_On (P, Less_Than (V)));
|
||||
|
||||
|
||||
function More_Than (P : Project_Name; V : Version) return Dependencies is
|
||||
(Depends_On (P, More_Than (V)));
|
||||
|
||||
|
||||
function Exactly (P : Project_Name; V : Version) return Dependencies is
|
||||
(Depends_On (P, Exactly (V)));
|
||||
|
||||
|
||||
function Except (P : Project_Name; V : Version) return Dependencies is
|
||||
(Depends_On (P, Except (V)));
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
with Semantic_Versioning;
|
||||
|
||||
package Alire.Properties.Versions is
|
||||
|
||||
type Version is new Property with record
|
||||
Value : Semantic_Versioning.Version;
|
||||
end record;
|
||||
|
||||
end Alire.Properties.Versions;
|
||||
@@ -2,6 +2,10 @@ with GNAT.OS_Lib;
|
||||
|
||||
package body Alire.Releases is
|
||||
|
||||
--------------
|
||||
-- Checkout --
|
||||
--------------
|
||||
|
||||
procedure Checkout (R : Release; Parent_Folder : String) is
|
||||
use GNAT.OS_Lib;
|
||||
Folder : constant String := Parent_Folder & Directory_Separator & R.Unique_Folder;
|
||||
|
||||
+43
-34
@@ -1,80 +1,89 @@
|
||||
with Alire.Depends;
|
||||
with Alire.Repositories;
|
||||
|
||||
package Alire.Releases
|
||||
with Preelaborate
|
||||
package Alire.Releases
|
||||
with Preelaborate
|
||||
is
|
||||
|
||||
subtype Dependencies is Depends.Dependencies;
|
||||
|
||||
type Release (<>) is tagged private;
|
||||
|
||||
|
||||
type Release (<>) is tagged private;
|
||||
|
||||
function New_Release (Project : Project_Name;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Repository : Repositories.Repository'Class;
|
||||
Id : Repositories.Release_Id;
|
||||
Depends_On : Dependencies) return Release;
|
||||
|
||||
function "<" (L, R : Release) return Boolean;
|
||||
|
||||
Depends_On : Dependencies;
|
||||
Native : Boolean) return Release;
|
||||
|
||||
function "<" (L, R : Release) return Boolean;
|
||||
|
||||
function Project (R : Release) return Project_Name;
|
||||
function Version (R : Release) return Semantic_Versioning.Version;
|
||||
function Depends (R : Release) return Dependencies;
|
||||
function Repo_Image (R : Release) return String;
|
||||
|
||||
|
||||
function Image (R : Release) return String;
|
||||
-- Unique string built as name-version-id
|
||||
-- Unique string built as name-version-id
|
||||
function Unique_Folder (R : Release) return String renames Image;
|
||||
|
||||
|
||||
function Milestone_Image (R : Release) return String;
|
||||
-- project=version string
|
||||
|
||||
|
||||
function Is_Native (R : Release) return Boolean;
|
||||
-- not alr packaged but from the platform
|
||||
|
||||
procedure Checkout (R : Release; Parent_Folder : String);
|
||||
-- Appends its unique folder to Parent_Folder
|
||||
-- May raise File_Error
|
||||
|
||||
private
|
||||
|
||||
|
||||
private
|
||||
|
||||
type Release (Name_Len, Id_Len : Positive) is tagged record
|
||||
Project : Project_Name (1 .. Name_Len);
|
||||
Version : Semantic_Versioning.Version;
|
||||
Repository : Repositories.Repository_H;
|
||||
Id : Repositories.Release_Id (1 .. Id_Len);
|
||||
Depends_On : Dependencies;
|
||||
end record;
|
||||
|
||||
Depends_On : Dependencies;
|
||||
Native : Boolean;
|
||||
end record;
|
||||
|
||||
function New_Release (Project : Project_Name;
|
||||
Version : Semantic_Versioning.Version;
|
||||
Repository : Repositories.Repository'Class;
|
||||
Id : Repositories.Release_Id;
|
||||
Depends_On : Dependencies) return Release is
|
||||
Depends_On : Dependencies;
|
||||
Native : Boolean) return Release is
|
||||
(Project'Length, Id'Length,
|
||||
Project,
|
||||
Project,
|
||||
Version,
|
||||
Repositories.To_Holder (Repository),
|
||||
Id,
|
||||
Depends_On);
|
||||
|
||||
function "<" (L, R : Release) return Boolean is
|
||||
Depends_On,
|
||||
Native);
|
||||
|
||||
function "<" (L, R : Release) return Boolean is
|
||||
(L.Project < R.Project or else
|
||||
(L.Project = R.Project and then L.Version < R.Version) or else
|
||||
(L.Project = R.Project and then
|
||||
L.Version = R.Version and then
|
||||
(L.Project = R.Project and then L.Version < R.Version) or else
|
||||
(L.Project = R.Project and then
|
||||
L.Version = R.Version and then
|
||||
L.Repository.Element.Image < R.Repository.Element.Image));
|
||||
|
||||
|
||||
function Project (R : Release) return Project_Name is (R.Project);
|
||||
function Version (R : Release) return Semantic_Versioning.Version is (R.Version);
|
||||
function Version (R : Release) return Semantic_Versioning.Version is (R.Version);
|
||||
function Depends (R : Release) return Dependencies is (R.Depends_On);
|
||||
|
||||
|
||||
function Is_Native (R : Release) return Boolean is (R.Native);
|
||||
|
||||
-- FIXME: this should be OS-sanitized to be a valid path
|
||||
function Image (R : Release) return String is
|
||||
(R.Project & "_" &
|
||||
Semantic_Versioning.Image (R.Version) & "_" &
|
||||
(R.Project & "_" &
|
||||
Semantic_Versioning.Image (R.Version) & "_" &
|
||||
(if R.Id'Length <= 8 then R.Id else R.Id (R.Id'First .. R.Id'First + 7)));
|
||||
|
||||
|
||||
function Milestone_Image (R : Release) return String is
|
||||
(R.Project & "=" & Semantic_Versioning.Image (R.Version));
|
||||
|
||||
|
||||
function Repo_Image (R : Release) return String is
|
||||
(R.Repository.Element.Image);
|
||||
|
||||
|
||||
@@ -9,7 +9,11 @@ package body Alire.Repositories.Apt is
|
||||
overriding procedure Checkout (R : Repository; Id : Release_Id; Folder : String) is
|
||||
pragma Unreferenced (R, Folder);
|
||||
begin
|
||||
OS_Lib.Spawn ("sudo", "apt install " & Id);
|
||||
Trace.Always ("sudo needed to install platform package " & Id);
|
||||
OS_Lib.Spawn_Bypass ("sudo", "apt-get install -q -q -y " & Id);
|
||||
exception
|
||||
when others =>
|
||||
Trace.Error ("Installation of native package " & Id & " failed");
|
||||
end Checkout;
|
||||
|
||||
end Alire.Repositories.Apt;
|
||||
|
||||
@@ -41,6 +41,8 @@ package Alire with Preelaborate is
|
||||
|
||||
use all type Simple_Logging.Levels;
|
||||
|
||||
package Trace renames Simple_Logging;
|
||||
|
||||
Log_Level : Simple_Logging.Levels renames Simple_Logging.Level;
|
||||
|
||||
procedure Log (S : String; Level : Simple_Logging.Levels := Info) renames Simple_Logging.Log;
|
||||
|
||||
Reference in New Issue
Block a user