-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'alire/master' into feat/publish-status
- Loading branch information
Showing
26 changed files
with
264 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule clic
updated
4 files
+20 −7 | src/clic-config-edit.adb | |
+4 −2 | src/clic-config-edit.ads | |
+11 −0 | src/clic-config.adb | |
+6 −0 | src/clic-config.ads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
with AAA.Strings; use AAA.Strings; | ||
|
||
with Alire.OS_Lib.Subprocess; | ||
with Alire.Errors; | ||
|
||
package body Alire.Origins.Deployers.System.Macports is | ||
|
||
-- Ada.Strings.Unbounded is use-visible via Alire.Origins. | ||
|
||
package Subprocess renames Alire.OS_Lib.Subprocess; | ||
|
||
----------------------- | ||
-- Already_Installed -- | ||
----------------------- | ||
|
||
overriding function Already_Installed (This : Deployer) return Boolean | ||
is | ||
Installed : AAA.Strings.Vector; | ||
begin | ||
Trace.Debug ("already_installed? " & This.Base.Package_Name); | ||
|
||
if Subprocess.Unchecked_Spawn_And_Capture | ||
("port", | ||
Empty_Vector & "echo" & "installed", | ||
Output => Installed, | ||
Err_To_Out => True) /= 0 | ||
then | ||
-- failed. | ||
Trace.Debug ("port failed to find any installed packages"); | ||
return False; | ||
end if; | ||
|
||
-- We get a list of all the installed packages, | ||
-- name {spaces} '@' version | ||
|
||
Trace.Debug (Installed.Length'Image & " installed packages"); | ||
|
||
for P of Installed loop | ||
Trace.Debug ("Checking '" & P & "'"); | ||
if AAA.Strings.Head (P, ' ') = This.Base.Package_Name then | ||
Trace.Debug ("found '" & P & "'"); | ||
return True; | ||
end if; | ||
end loop; | ||
|
||
return False; -- until we've implemented Install | ||
end Already_Installed; | ||
|
||
------------ | ||
-- Detect -- | ||
------------ | ||
|
||
-- Returns the package version, if the package exists, whether or | ||
-- not it's installed. | ||
-- | ||
-- If it's not installed, what you get is the version that would | ||
-- be installed. | ||
|
||
overriding | ||
function Detect (This : Deployer) return Version_Outcomes.Outcome | ||
is | ||
Info : AAA.Strings.Vector; | ||
begin | ||
Trace.Debug ("detect? " & This.Base.Package_Name); | ||
|
||
if Subprocess.Unchecked_Spawn_And_Capture | ||
("port", | ||
Empty_Vector & "info" & "--version" & This.Base.Package_Name, | ||
Output => Info, | ||
Err_To_Out => True) /= 0 | ||
then | ||
-- failed. | ||
Trace.Debug ("port failed to find " & This.Base.Package_Name); | ||
return Version_Outcomes.Outcome_Failure | ||
("no candidate version found", | ||
Report => False); | ||
end if; | ||
|
||
if Integer (Info.Length) /= 1 then | ||
raise Constraint_Error | ||
with "port info --version returned" & Info.Length'Image & " lines."; | ||
end if; | ||
|
||
Trace.Debug ("port info output: " & Info (Info.First)); | ||
declare | ||
Version : constant String := Trim (Tail (Info (Info.First), ':')); | ||
begin | ||
Trace.Debug (" -> version: '" & Version & "'"); | ||
return Version_Outcomes.New_Result (Semantic_Versioning.Parse | ||
(Version, | ||
Relaxed => True)); | ||
end; | ||
|
||
end Detect; | ||
|
||
------------- | ||
-- Install -- | ||
------------- | ||
|
||
overriding | ||
function Install (This : Deployer) return Outcome is | ||
begin | ||
Trace.Debug ("hoping to install: " & This.Base.Image); | ||
Subprocess.Checked_Spawn | ||
("sudo", | ||
Empty_Vector & "port" & "install" & This.Base.Package_Name); | ||
|
||
return Outcome_Success; | ||
exception | ||
when E : others => | ||
return Alire.Errors.Get (E); | ||
end Install; | ||
|
||
end Alire.Origins.Deployers.System.Macports; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package Alire.Origins.Deployers.System.Macports is | ||
|
||
type Deployer is new Deployers.System.Deployer with null record; | ||
|
||
overriding | ||
function Already_Installed (This : Deployer) return Boolean; | ||
|
||
overriding | ||
function Detect (This : Deployer) | ||
return Version_Outcomes.Outcome; | ||
|
||
overriding | ||
function Install (This : Deployer) return Outcome; | ||
|
||
end Alire.Origins.Deployers.System.Macports; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.