diff --git a/src/alr/alr-commands-search.adb b/src/alr/alr-commands-search.adb index ed6485f38..becb67df5 100644 --- a/src/alr/alr-commands-search.adb +++ b/src/alr/alr-commands-search.adb @@ -51,7 +51,12 @@ package body Alr.Commands.Search is (if R.Is_Available (Platform.Properties) then " " else Flag_Unav) & (if R.Origin.Is_System then " " else - (if Solver.Is_Resolvable + (if not Cmd.Solve + then + (if R.Dependencies (Platform.Properties).Is_Empty + then " " + else TTY.Dim ("?")) + elsif Solver.Is_Resolvable (R.Dependencies (Platform.Properties), Platform.Properties, Alire.Solutions.Empty_Valid_Solution, @@ -334,6 +339,8 @@ package body Alr.Commands.Search is .Append ("E: the release is externally provided.") .Append ("S: the release is available through a system package.") .Append ("U: the release is not available in the current platform.") + .Append ("?: the release has dependencies but solving was skipped " + & "(see --solve).") .Append ("X: the release has dependencies that cannot be resolved.") .New_Line .Append ("The reasons for unavailability (U) can be ascertained with" @@ -383,6 +390,11 @@ package body Alr.Commands.Search is Cmd.External'Access, "", "--external", "Include externally-provided releases in search"); + + Define_Switch (Config, + Cmd.Solve'Access, + "", "--solve", + "Solve dependencies of releases"); end Setup_Switches; end Alr.Commands.Search; diff --git a/src/alr/alr-commands-search.ads b/src/alr/alr-commands-search.ads index 8e0e40ecd..7bcbbd11f 100644 --- a/src/alr/alr-commands-search.ads +++ b/src/alr/alr-commands-search.ads @@ -36,6 +36,7 @@ private Full : aliased Boolean := False; List : aliased Boolean := False; External : aliased Boolean := False; + Solve : aliased Boolean := False; end record; end Alr.Commands.Search; diff --git a/testsuite/tests/search/basic/test.py b/testsuite/tests/search/basic/test.py index ab4deac3d..b650b90dd 100644 --- a/testsuite/tests/search/basic/test.py +++ b/testsuite/tests/search/basic/test.py @@ -17,9 +17,16 @@ def format_table(*args): lines.append(format_line(*arg)) return ''.join(lines) - -# List latest releases crates +# List latest releases crates, without solving dependencies p = run_alr('search', '--list') +assert_eq(format_table( + ('hello', ' ?', '1.0.1', '"Hello, world!" demonstration project', '', ''), + ('libhello', '', '1.0.0', + '"Hello, world!" demonstration project support library', '', ''), +), p.out) + +# List latest releases crates, solving dependencies +p = run_alr('search', '--list', '--solve') assert_eq(format_table( ('hello', '', '1.0.1', '"Hello, world!" demonstration project', '', ''), ('libhello', '', '1.0.0', @@ -28,7 +35,7 @@ def format_table(*args): # List all releases crates -p = run_alr('search', '--list', '--full') +p = run_alr('search', '--list', '--full', '--solve') assert_eq(format_table( ('hello', '', '1.0.1', '"Hello, world!" demonstration project', '', ''), ('hello', '', '1.0.0', '"Hello, world!" demonstration project', '', ''),