diff --git a/charmcraft/application/commands/store.py b/charmcraft/application/commands/store.py index 2770945ca..ec0a4bd16 100644 --- a/charmcraft/application/commands/store.py +++ b/charmcraft/application/commands/store.py @@ -31,6 +31,7 @@ from operator import attrgetter from typing import TYPE_CHECKING, Any +import craft_platforms import yaml from craft_application import util from craft_cli import ArgumentParsingError, emit @@ -2009,7 +2010,8 @@ def run(self, parsed_args: argparse.Namespace) -> int: ) image_arch = [ - utils.ARCH_TRANSLATIONS.get(arch, arch) for arch in image_metadata.architectures + craft_platforms.DebianArchitecture.from_machine(arch).value + for arch in image_metadata.architectures ] bases = [{"name": "all", "channel": "all", "architectures": image_arch}] diff --git a/charmcraft/utils/__init__.py b/charmcraft/utils/__init__.py index 9da3a161e..eac510698 100644 --- a/charmcraft/utils/__init__.py +++ b/charmcraft/utils/__init__.py @@ -40,7 +40,6 @@ humanize_list, ) from charmcraft.utils.platform import ( - ARCH_TRANSLATIONS, OSPlatform, get_os_platform, validate_architectures, @@ -77,7 +76,6 @@ "get_lib_info", "get_libs_from_tree", "collect_charmlib_pydeps", - "ARCH_TRANSLATIONS", "OSPlatform", "get_os_platform", "validate_architectures", diff --git a/charmcraft/utils/platform.py b/charmcraft/utils/platform.py index 2e3152161..b5cd6da33 100644 --- a/charmcraft/utils/platform.py +++ b/charmcraft/utils/platform.py @@ -35,20 +35,7 @@ class OSPlatform: machine: str -# translations from what the platform module informs to the term deb and -# snaps actually use -ARCH_TRANSLATIONS = { - "aarch64": "arm64", - "armv7l": "armhf", - "i686": "i386", - "ppc": "powerpc", - "ppc64le": "ppc64el", - "x86_64": "amd64", - "AMD64": "amd64", # Windows support -} - - -def get_os_platform(filepath=pathlib.Path("/etc/os-release")): +def get_os_platform(filepath: pathlib.Path = pathlib.Path("/etc/os-release")) -> OSPlatform: """Determine a system/release combo for an OS using /etc/os-release if available.""" system = platform.system() release = platform.release() diff --git a/pyproject.toml b/pyproject.toml index bc802e6b9..4476ed8e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ dependencies = [ "craft-application~=3.0", "craft-cli>=2.3.0", "craft-parts>=1.18", + "craft-platforms~=0.1", "craft-providers>=1.23.0", "craft-store>=2.4", "distro>=1.3.0", diff --git a/requirements-dev.txt b/requirements-dev.txt index ce5df05e8..595f70d03 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,6 +8,7 @@ craft-archives==1.2.0 craft-cli==2.6.0 craft-grammar==1.2.0 craft-parts==1.33.0 +craft-platforms==0.1.1 craft-providers==1.24.1 craft-store==2.6.2 cryptography==42.0.8 diff --git a/requirements.txt b/requirements.txt index b0cb6c7d3..606ca0af1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,6 +7,7 @@ craft-archives==1.2.0 craft-cli==2.6.0 craft-grammar==1.2.0 craft-parts==1.33.0 +craft-platforms==0.1.1 craft-providers==1.24.1 craft-store==2.6.2 cryptography==42.0.8 diff --git a/tests/conftest.py b/tests/conftest.py index 4a2cedecb..43c422af3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,7 +34,7 @@ from craft_providers import Executor, Provider, bases import charmcraft.parts -from charmcraft import const, deprecations, instrum, parts, services, store, utils +from charmcraft import const, deprecations, instrum, parts, services, store from charmcraft.application.main import APP_METADATA from charmcraft.bases import get_host_as_base from charmcraft.models import charmcraft as config_module