Skip to content

Commit

Permalink
Also report distro detection disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Feb 15, 2024
1 parent ec724e6 commit d680bdc
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
16 changes: 12 additions & 4 deletions src/alire/alire-origins-deployers-system.adb
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,24 @@ package body Alire.Origins.Deployers.System is
end Dont_Ask_Permission;

---------------------
-- Executable_Path --
-- Executable_Name --
---------------------

function Executable_Path return Optional_Absolute_Path is
function Executable_Name return String is
Make : constant Origin := New_System ("make");
-- We use a mock system package to be able to obtain a deployer. It
-- doesn't matter if this system package doesn't exist.
begin
return OS_Lib.Locate_Exec_On_Path
(Platform_Deployer (Make).Executable_Name);
return Platform_Deployer (Make).Executable_Name;
end Executable_Name;

---------------------
-- Executable_Path --
---------------------

function Executable_Path return Optional_Absolute_Path is
begin
return OS_Lib.Locate_Exec_On_Path (Executable_Name);
end Executable_Path;

end Alire.Origins.Deployers.System;
7 changes: 5 additions & 2 deletions src/alire/alire-origins-deployers-system.ads
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ package Alire.Origins.Deployers.System is
function Platform_Deployer (Package_Name : String) return Deployer'Class is
(Platform_Deployer (Origins.New_System (Package_Name)));

function Executable_Name return String;
-- Returns the simple name of the executable package manager on the system

function Executable_Path return Optional_Absolute_Path;
-- Identifies the package manager executable being called in the current
-- platform, or "" if none found.
-- Identifies the full path to the package manager executable found in the
-- current platform, even if distro detection is disabled.

private

Expand Down
3 changes: 2 additions & 1 deletion src/alire/alire-os_lib.ads
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package Alire.OS_Lib with Preelaborate is
procedure Setenv (Name : String; Value : String);

function Locate_Exec_On_Path (Exec_Name : String) return String;
-- Return the location of an executable if found on PATH, or "" otherwise
-- Return the location of an executable if found on PATH, or "" otherwise.
-- On Windows, no need to append ".exe" as it will be found without it.

end Alire.OS_Lib;
20 changes: 16 additions & 4 deletions src/alr/alr-commands-version.adb
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,22 @@ package body Alr.Commands.Version is
end loop;
end;

Table
.Append ("system package manager:")
.Append (Alire.Origins.Deployers.System.Executable_Path)
.New_Row;
declare
System_Manager : constant String :=
Origins.Deployers.System.Executable_Path;
begin
Table
.Append ("system package manager:")
.Append (if System_Manager /= ""
then System_Manager
else "not found: `"
& Origins.Deployers.System.Executable_Name & "`")
.New_Row;
Table
.Append ("distro detection disabled:")
.Append (Platforms.Current.Disable_Distribution_Detection'Image)
.New_Row;
end;

Table.Append ("").New_Row;
Table.Append ("WORKSPACE").New_Row;
Expand Down

0 comments on commit d680bdc

Please sign in to comment.