Skip to content

Commit

Permalink
core: version chooser: deal with 64bit kernel 32bit userland case
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani authored and patrickelectric committed Jan 20, 2025
1 parent 605ab4c commit c965e09
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions core/services/versionchooser/utils/dockerhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c965e09

Please sign in to comment.