All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: meta-virtualization@lists.yoctoproject.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [meta-virtualization][PATCH] classes/image-oci: Map x86_64 -> amd64
Date: Mon, 16 Oct 2023 15:26:26 -0600	[thread overview]
Message-ID: <20231016212626.2146963-1-JPEWhacker@gmail.com> (raw)

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.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>

[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 <JPEWhacker@gmail.com>
---
 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
+
 # Generate a subarch that is appropriate to OCI image
 # types. This is typically only ARM architectures at the
 # moment.
-- 
2.34.1



             reply	other threads:[~2023-10-16 21:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 21:26 Joshua Watt [this message]
2023-10-17  1:35 ` [meta-virtualization][PATCH] classes/image-oci: Map x86_64 -> amd64 Bruce Ashfield
2023-10-17 13:46   ` Joshua Watt
2023-10-17 14:01     ` Bruce Ashfield
2023-10-30 19:08 ` [meta-virtualization][PATCH v2] classes/image-oci: Map image architecture correctly Joshua Watt
2023-11-03  3:25   ` Bruce Ashfield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231016212626.2146963-1-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=meta-virtualization@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.