1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-04-02 00:07:16 +01:00

Fix apps build using wrong architecture for non-native arch apps (#6610)

* Fix add-on build using wrong architecture for non-native arch add-ons

When building a locally-built add-on (no image tag), the architecture
was always set to sys_arch.default (e.g. amd64 on x86_64) instead of
matching against the add-on's declared architectures. This caused an
i386-only add-on to incorrectly build as amd64.

Use sys_arch.match() against the add-on's declared arch list in all
code paths: the arch property, image name generation, BUILD_ARCH build
arg, and default base image selection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Use CpuArch enums to fix tests

* Explicitly set _supported_arch as new list to fix tests

* Fix pytests

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Stefan Agner
2026-03-03 15:36:30 +01:00
committed by GitHub
parent 2627d55873
commit 96fb26462b
4 changed files with 16 additions and 15 deletions

View File

@@ -48,6 +48,7 @@ from supervisor.const import (
ATTR_VERSION,
REQUEST_FROM,
CoreState,
CpuArch,
)
from supervisor.coresys import CoreSys
from supervisor.dbus.network import NetworkManager
@@ -506,8 +507,9 @@ async def coresys(
"Config": {"Labels": {"io.hass.arch": "amd64"}},
"HostConfig": {"Privileged": True},
}
coresys_obj.arch._default_arch = "amd64"
coresys_obj.arch._supported_set = {"amd64"}
coresys_obj.arch._default_arch = CpuArch.AMD64
coresys_obj.arch._supported_arch = [CpuArch.AMD64]
coresys_obj.arch._supported_set = {CpuArch.AMD64}
coresys_obj._machine = "qemux86-64"
coresys_obj._machine_id = uuid4()
@@ -984,15 +986,15 @@ async def mount_propagation(container: DockerContainer, coresys: CoreSys) -> Non
@pytest.fixture
def mock_amd64_arch_supported(coresys: CoreSys) -> None:
"""Mock amd64 arch as supported."""
coresys.arch._supported_arch = ["amd64"]
coresys.arch._supported_set = {"amd64"}
coresys.arch._supported_arch = [CpuArch.AMD64]
coresys.arch._supported_set = {CpuArch.AMD64}
@pytest.fixture
def mock_aarch64_arch_supported(coresys: CoreSys) -> None:
"""Mock aarch64 arch as supported."""
coresys.arch._supported_arch = ["amd64"]
coresys.arch._supported_set = {"amd64"}
coresys.arch._supported_arch = [CpuArch.AMD64]
coresys.arch._supported_set = {CpuArch.AMD64}
@pytest.fixture