On Mon, Oct 16, 2023 at 5:26 PM Joshua Watt <[email protected]> wrote:
>
> OCI requires that the architecture [1] be a valid GOARCH [2]. "x86_64"
> is not a valid GOARCH so map it to the correct "amd64" value.
>

It may require it, but I've never had any issues with a container running.

Are you seeing a warning or something else ?

> Signed-off-by: Joshua Watt <[email protected]>
>
> [1]: 
> https://github.com/opencontainers/image-spec/blob/main/config.md#properties
> [2]: https://go.dev/doc/install/source#environment
>
> Signed-off-by: Joshua Watt <[email protected]>
> ---
>  classes/image-oci.bbclass | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/classes/image-oci.bbclass b/classes/image-oci.bbclass
> index 9ddb88b..3370f86 100644
> --- a/classes/image-oci.bbclass
> +++ b/classes/image-oci.bbclass
> @@ -52,7 +52,7 @@ OCI_IMAGE_AUTHOR_EMAIL ?= "${PATCH_GIT_USER_EMAIL}"
>  OCI_IMAGE_TAG ?= "latest"
>  OCI_IMAGE_RUNTIME_UID ?= ""
>
> -OCI_IMAGE_ARCH ?= "${TARGET_ARCH}"
> +OCI_IMAGE_ARCH ?= "${@oci_map_arch(d.getVar('TARGET_ARCH'))}"
>  OCI_IMAGE_SUBARCH ?= "${@oci_map_subarch(d.getVar('TARGET_ARCH'), 
> d.getVar('TUNE_FEATURES'), d)}"
>
>  OCI_IMAGE_ENTRYPOINT ?= "sh"
> @@ -74,6 +74,13 @@ OCI_IMAGE_ENV_VARS ?= ""
>  # bundled into a tarball.
>  OCI_IMAGE_TAR_OUTPUT ?= "true"
>
> +# Map architectures to a valid container arch. Note that the container archs
> +# should be a valid GOARCH
> +def oci_map_arch(a):
> +    if a == "x86_64":
> +        return "amd64"
> +    return a

If it is supposed to match to the goarch, why wouldn't we just use the
goarch.bbclass mapping ?

Bruce

> +
>  # Generate a subarch that is appropriate to OCI image
>  # types. This is typically only ARM architectures at the
>  # moment.
> --
> 2.34.1
>
>
> 
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8378): 
https://lists.yoctoproject.org/g/meta-virtualization/message/8378
Mute This Topic: https://lists.yoctoproject.org/mt/102006091/21656
Group Owner: [email protected]
Unsubscribe: 
https://lists.yoctoproject.org/g/meta-virtualization/leave/6693005/21656/1014668956/xyzzy
 [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to