diff --git a/src/alire-os_lib.adb b/src/alire-os_lib.adb index c7217d2e..d2dee59a 100644 --- a/src/alire-os_lib.adb +++ b/src/alire-os_lib.adb @@ -25,7 +25,7 @@ package body Alire.OS_Lib is ----------- -- FIXME: memory leaks function Spawn (Command : String; - Arguments : String) return Integer is + Arguments : String := "") return Integer is begin Log ("Spawning: " & Command & " " & Arguments, Verbose); return @@ -38,7 +38,7 @@ package body Alire.OS_Lib is ----------- procedure Spawn (Command : String; - Arguments : String) + Arguments : String := "") is Code : constant Integer := Spawn (Command, Arguments); begin diff --git a/src/alire-os_lib.ads b/src/alire-os_lib.ads index 22728b78..02fec614 100644 --- a/src/alire-os_lib.ads +++ b/src/alire-os_lib.ads @@ -4,11 +4,11 @@ with Ada.Finalization; package Alire.OS_Lib is function Spawn (Command : String; - Arguments : String) return Integer; + Arguments : String := "") return Integer; -- Returns exit code procedure Spawn (Command : String; - Arguments : String); + Arguments : String:= ""); -- Raises PROGRAM_ERROR if exit code /= 0 type Folder_Guard (<>) is limited private; diff --git a/src/alire-query.adb b/src/alire-query.adb index 392c4bf2..d10e72bd 100644 --- a/src/alire-query.adb +++ b/src/alire-query.adb @@ -40,7 +40,8 @@ package body Alire.Query is ------------- function Resolve (Unresolved : Dependencies; - Frozen : Instance) return Instance + Frozen : Instance; + Success : out Boolean) return Instance is -- FIXME: since this is depth-first, Frozen can be passed in-out and updated on the spot, -- thus saving copies. Probably the same applies to Unresolved. @@ -60,11 +61,12 @@ package body Alire.Query is Print_Solution (Frozen); return Frozen; else - return Resolve (Unresolved, Frozen); + return Resolve (Unresolved, Frozen, Success); end if; end Go_Deeper; begin + Remain.Delete_First; if Frozen.Contains (Dep.Project) then @@ -92,6 +94,7 @@ package body Alire.Query is Solution := Go_Deeper (New_Remain, New_Frozen); if not Solution.Is_Empty then + Success := True; return Solution; -- Success! end if; end; @@ -107,9 +110,12 @@ package body Alire.Query is -- Resolve -- ------------- - function Resolve (Deps : Dependencies) return Instance is + function Resolve (Deps : Dependencies; + Success : out Boolean) return Instance is begin - return Resolve (Deps, Containers.Project_Release_Maps.Empty_Map); + Success := False; + + return Resolve (Deps, Containers.Project_Release_Maps.Empty_Map, Success); end Resolve; end Alire.Query; diff --git a/src/alire-query.ads b/src/alire-query.ads index d1cf71b9..ad2e5cc4 100644 --- a/src/alire-query.ads +++ b/src/alire-query.ads @@ -4,7 +4,8 @@ package Alire.Query is function Exists (Project : Project_Name) return Boolean; - function Resolve (Deps : Dependencies) return Instance; + function Resolve (Deps : Dependencies; + Success : out Boolean) return Instance; procedure Print_Solution (I : Instance); diff --git a/src/alire.adb b/src/alire.adb index 24e3e123..fecc2928 100644 --- a/src/alire.adb +++ b/src/alire.adb @@ -8,8 +8,8 @@ package body Alire is GNAT.IO.Put_Line ((case Level is when Terse => "", - when Verbose => ": ", - when Debug => "+++ ") & S); + when Verbose => "> ", + when Debug => ">> ") & S); end if; end Log;