Notify of success on looking for deps

This commit is contained in:
Jano at Zelda
2018-02-01 19:12:19 +01:00
parent 9fdcbb7c84
commit 1b87e79466
5 changed files with 18 additions and 11 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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;
+10 -4
View File
@@ -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;
+2 -1
View File
@@ -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);
+2 -2
View File
@@ -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;