From fcc74297c8d0ead3f269b648a016327750ff5ea6 Mon Sep 17 00:00:00 2001 From: Alejandro R Mosteo Date: Tue, 5 Apr 2022 15:44:12 +0200 Subject: [PATCH] Remapping of ARM64 to AARCH64 (#968) * Remapping of ARM64 to AARCH64 * Code review fix Co-authored-by: GHA --- src/alire/alire-platforms-common.adb | 6 ++++-- src/alire/alire-platforms.ads | 32 ++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/alire/alire-platforms-common.adb b/src/alire/alire-platforms-common.adb index cc42bd81..358e1ab6 100644 --- a/src/alire/alire-platforms-common.adb +++ b/src/alire/alire-platforms-common.adb @@ -36,7 +36,8 @@ package body Alire.Platforms.Common is -- Detection in unix-like platforms Detect : declare - function Is_Known_Arch is new AAA.Enum_Tools.Is_Valid (Architectures); + function Is_Known_Arch is + new AAA.Enum_Tools.Is_Valid (Extended_Architectures); Output : AAA.Strings.Vector; @@ -59,7 +60,8 @@ package body Alire.Platforms.Common is else if Is_Known_Arch (Name) then Trace.Debug ("uname known machine string is: " & Name); - Arch_Value := Architectures'Value (Name); + Arch_Value := + Arch_Mapping (Extended_Architectures'Value (Name)); else Trace.Debug ("uname unknown machine string is: " & Name); end if; diff --git a/src/alire/alire-platforms.ads b/src/alire/alire-platforms.ads index b5fe278a..ae3cb199 100644 --- a/src/alire/alire-platforms.ads +++ b/src/alire/alire-platforms.ads @@ -2,13 +2,21 @@ package Alire.Platforms with Preelaborate is -- Platform information necessary for some releases - type Architectures is (ARM, - AARCH64, - AARCH64_BE, - I386, - I686, - X86_64, - Architecture_Unknown); + type Extended_Architectures is + (ARM64, -- Equivalent to AARCH64 + End_Of_Duplicates, + -- Up to this point, these are architectures that we want to rename to + -- some of the following because they are equivalent. + ARM, + AARCH64, + AARCH64_BE, + I386, + I686, + X86_64, + Architecture_Unknown); + + subtype Architectures is Extended_Architectures range + Extended_Architectures'Succ (End_Of_Duplicates) .. Architecture_Unknown; -- See e.g. https://stackoverflow.com/a/45125525/761390 type Operating_Systems is (Linux, @@ -62,4 +70,14 @@ package Alire.Platforms with Preelaborate is type Shells is (Unix, PowerShell, WinCmd); +private + + function Arch_Mapping (Arch : Extended_Architectures) return Architectures + is (case Arch is + when ARM64 => AARCH64, + when Architectures => Arch, + when others => + raise Program_Error + with "Mapping missing for given architecture: " & Arch'Image); + end Alire.Platforms; -- 2.39.5