-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use debian arch in platforms (#380)
This commit puts Rockcraft in line with other craft tools: the architectures listed in the platforms are in Debian format, and we convert to GOARCH when necessary (such as when fetching images from a Docker registry or creating empty ones with umoci). As a side-effect, we also drop the "build variant" notion from the platforms - currently this variant is only used when fetching/creating images, so keep the variant logic localized to rockcraft.oci.
- Loading branch information
Showing
8 changed files
with
157 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- | ||
# | ||
# Copyright 2023 Canonical Ltd. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
"""Architecture definitions and conversions for Debian and Go/Docker.""" | ||
|
||
from __future__ import annotations | ||
|
||
import dataclasses | ||
|
||
|
||
@dataclasses.dataclass(frozen=True) | ||
class ArchitectureMapping: | ||
"""Mapping of a Debian arch to Go arch/variant (for use with registries). | ||
The Go-related values must conform to: | ||
https://github.com/opencontainers/image-spec/blob/67d2d5658fe0476ab9bf414cec164077ebff3920/config.md#properties | ||
""" | ||
|
||
description: str | ||
go_arch: str | ||
go_variant: str | None = None | ||
|
||
|
||
# The keys are valid debian architectures. | ||
SUPPORTED_ARCHS: dict[str, ArchitectureMapping] = { | ||
"amd64": ArchitectureMapping( | ||
description="Intel 64", | ||
go_arch="amd64", | ||
), | ||
"armhf": ArchitectureMapping( | ||
description="ARM 32-bit", go_arch="arm", go_variant="v7" | ||
), | ||
"arm64": ArchitectureMapping( | ||
description="ARM 64-bit", go_arch="arm64", go_variant="v8" | ||
), | ||
"i386": ArchitectureMapping( | ||
description="Intel 386", | ||
go_arch="386", | ||
), | ||
"ppc64el": ArchitectureMapping( | ||
description="PowerPC 64-bit", | ||
go_arch="ppc64le", | ||
), | ||
"riscv64": ArchitectureMapping( | ||
description="RISCV 64-bit", | ||
go_arch="riscv64", | ||
), | ||
"s390x": ArchitectureMapping( | ||
description="IBM Z 64-bit", | ||
go_arch="s390x", | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.