Skip to content

Commit

Permalink
Platforms: distribution-unknown to better match... (#1590)
Browse files Browse the repository at this point in the history
...its variable name which is `distribution`
  • Loading branch information
mosteo authored Feb 27, 2024
1 parent b2b96ae commit dea1d18
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 23 deletions.
3 changes: 2 additions & 1 deletion src/alire/alire-externals-from_system.adb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ package body Alire.Externals.From_System is
-- We show either the requested Distro only, or all distros, which is
-- signaled by Distro = Unknown.

if Concrete_Distro = Distro or else Distro = Platforms.Distro_Unknown
if Concrete_Distro = Distro or else
Distro = Platforms.Distribution_Unknown
then
declare
On_Distro : constant Conditional_Packages.Tree :=
Expand Down
6 changes: 3 additions & 3 deletions src/alire/alire-platforms-current.ads
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ package Alire.Platforms.Current is
-- via config.

function Distribution_Is_Known return Boolean is
(Platforms."/=" (Distribution, Platforms.Distro_Unknown));
(Platforms."/=" (Distribution, Platforms.Distribution_Unknown));

function Host_Architecture return Platforms.Architectures;

Expand All @@ -76,7 +76,7 @@ private

function Distribution return Platforms.Distributions
is (if Disable_Distribution_Detection
then Platforms.Distro_Unknown
then Platforms.Distribution_Unknown
else Detected_Distribution);

-----------------------
Expand Down Expand Up @@ -112,7 +112,7 @@ private
---------------

function Toolchain return Platforms.Toolchains is
(if Distribution /= Distro_Unknown
(if Distribution /= Distribution_Unknown
and then
Alire.OS_Lib.Subprocess.Locate_In_Path ("gprconfig") =
"/usr/bin/gprconfig"
Expand Down
4 changes: 2 additions & 2 deletions src/alire/alire-platforms.ads
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ package Alire.Platforms with Preelaborate is
Suse,
Homebrew,
Macports,
Distro_Unknown);
Distribution_Unknown);

subtype Known_Distributions is
Distributions range Distributions'First ..
Expand All @@ -70,7 +70,7 @@ package Alire.Platforms with Preelaborate is
Suse => Zypper,
Homebrew => Homebrew,
Macports => Macports,
Distro_Unknown => Packager_Unknown);
Distribution_Unknown => Packager_Unknown);

type Toolchains is (System,
-- Provided through system packages, able to use other
Expand Down
2 changes: 1 addition & 1 deletion src/alire/alire-utils-tools.adb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ package body Alire.Utils.Tools is
begin
case Distribution is

when Distro_Unknown =>
when Distribution_Unknown =>
-- Cannot have package for an unknown distribution
return "";

Expand Down
4 changes: 2 additions & 2 deletions src/alire/os_freebsd/alire-platforms-current__freebsd.adb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ package body Alire.Platforms.Current is
-- Detected_Distribution --
---------------------------

function Detected_Distribution return Platforms.Distributions is
(Platforms.Distro_Unknown);
function Detected_Distribution return Platforms.Distributions
is (Platforms.Distribution_Unknown);

-----------------------
-- Distribution_Root --
Expand Down
10 changes: 5 additions & 5 deletions src/alire/os_linux/alire-platforms-current__linux.adb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package body Alire.Platforms.Current is
Trace.Debug ("Distribution identity file not found: "
& OS_Identity_File);
Distro_Cached := True;
Cached_Distro := Distro_Unknown;
Cached_Distro := Distribution_Unknown;
return Cached_Distro;
else
declare
Expand Down Expand Up @@ -79,7 +79,7 @@ package body Alire.Platforms.Current is
end;
end loop;

return Distro_Unknown;
return Distribution_Unknown;

end Get_Os_Release_Value_For_Key;

Expand All @@ -89,15 +89,15 @@ package body Alire.Platforms.Current is
Get_Os_Release_Value_For_Key (Key => "id");

-- If no supported distribution found, fallback to id_like key
if Cached_Distro = Distro_Unknown then
if Cached_Distro = Distribution_Unknown then
Trace.Debug
("Unknown distro for key 'id', falling back to 'id_like'");
Cached_Distro :=
Get_Os_Release_Value_For_Key (Key => "id_like");
end if;

-- Still an unsupported distribution ?
if Cached_Distro = Distro_Unknown then
if Cached_Distro = Distribution_Unknown then
Trace.Debug ("Found unsupported distro: " & Release (1));
end if;

Expand All @@ -109,7 +109,7 @@ package body Alire.Platforms.Current is
when E : Checked_Error =>
Trace.Debug ("Unable to detect distribution:");
Log_Exception (E);
return Distro_Unknown;
return Distribution_Unknown;
end Detected_Distribution;

-----------------------
Expand Down
2 changes: 1 addition & 1 deletion src/alire/os_macos/alire-platforms-current__macos.adb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ package body Alire.Platforms.Current is
then Homebrew
elsif Macports_Present
then Macports
else Distro_Unknown);
else Distribution_Unknown);

-----------------------
-- Distribution_Root --
Expand Down
4 changes: 2 additions & 2 deletions src/alire/os_windows/alire-platforms-current__windows.adb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package body Alire.Platforms.Current is
-- Windows implementation

Distrib_Detected : Boolean := False;
Distrib : Platforms.Distributions := Platforms.Distro_Unknown;
Distrib : Platforms.Distributions := Platforms.Distribution_Unknown;

------------------
-- Detect_Msys2 --
Expand Down Expand Up @@ -60,7 +60,7 @@ package body Alire.Platforms.Current is
return;
end if;

Distrib := Platforms.Distro_Unknown;
Distrib := Platforms.Distribution_Unknown;
end Detect_Distrib;

------------------
Expand Down
2 changes: 1 addition & 1 deletion src/alr/alr-commands-show.adb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ package body Alr.Commands.Show is
External.Detail
(if Cmd.System
then Alire.Platforms.Current.Distribution
else Alire.Platforms.Distro_Unknown);
else Alire.Platforms.Distribution_Unknown);
Available : Alire.Conditional.Availability :=
(if Cmd.System
then External.On_Platform
Expand Down
2 changes: 1 addition & 1 deletion testsuite/drivers/alr.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CalledProcessError(Exception):

def distro_is_known():
p = run_alr('version')
return not re.match('.*distribution:.*DISTRO_UNKNOWN.*',
return not re.match('.*distribution:.*DISTRIBUTION_UNKNOWN.*',
p.out, flags=re.S)


Expand Down
4 changes: 0 additions & 4 deletions testsuite/tests/config/distro-disable/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
Verify that disabling distro detection works as intended
"""

import os

from glob import glob

from drivers.alr import run_alr, distro_is_known

run_alr("config", "--global",
Expand Down

0 comments on commit dea1d18

Please sign in to comment.