From c965e0942bb6e49de1489ff8f275b49c4c087570 Mon Sep 17 00:00:00 2001 From: Willian Galvani Date: Mon, 20 Jan 2025 14:42:39 -0300 Subject: [PATCH] core: version chooser: deal with 64bit kernel 32bit userland case --- .../services/versionchooser/utils/dockerhub.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/core/services/versionchooser/utils/dockerhub.py b/core/services/versionchooser/utils/dockerhub.py index 844e533ffc..5b031db070 100644 --- a/core/services/versionchooser/utils/dockerhub.py +++ b/core/services/versionchooser/utils/dockerhub.py @@ -15,12 +15,20 @@ def get_current_arch() -> str: """Maps platform.machine() outputs to docker architectures""" - arch_map = {"x86_64": "amd64", "aarch64": "arm64", "armv7l": "arm"} machine = platform.machine() - arch = arch_map.get(machine, None) - if not arch: - raise RuntimeError(f"Unknown architecture! {machine}") - return arch + + match machine: + case "armv7l": + return "arm" + case "x86_64" | "amd64": + return "amd64" + case "aarch64" | "arm64": + # catch the case of 64 bit kernel with 32bit userland on Pi 5 + if platform.architecture()[0] == "32bit": + return "arm" + return "arm64" + case _: + raise RuntimeError(f"Unknown architecture! {machine}") @dataclass