Patch: Create non-versioned symlink to tezi tarball

When doing a custom Yocto build of a torizon-core-docker image, this generates an output file like:

deploy/images/verdin-imx8mp/torizon-core-docker-verdin-imx8mp-Tezi_6.5.0-devel-20231213163121+build.0.tar

This includes a build timestamp, meaning that every build has a unique filename. This makes it hard to reference the build result from e.g. tcbuild.yaml for further customization and deployment.

For a lot of other files in the same deploy directory, this is solved by creating an unversioned symlink, but not for the tarball currently.

Below I’ve posted a patch that solves this. The patch is made and tested against the kirkstone-6.x.y branch of meta-toradex-bsp-common (because that’s what I had here), but I think it should be trivial to apply to master as well (looking at the history there will be an easy-to-solve conflict).

I would have submitted a PR, but this repo does not seem be be available on Github, Gitlab or similar. If there is a different preferred way for contributions like these (maybe create a fork of the repo somewhere and push the commit there), let me know and I can submit the patch differently.

From 5e1dd2d7550887f27adeaab92eaa31a479d87d39 Mon Sep 17 00:00:00 2001
From: Matthijs Kooijman <matthijs@stdin.nl>
Date: Wed, 13 Dec 2023 17:09:05 +0100
Subject: [PATCH] image_type_tezi: Create unversioned symlink to tarball

This makes it easier to reference a custom produced image in a deploy or
customization (e.g. with torizoncore-builder) workflow.

Variable names and the link command are modeled after
/meta-toradex-torizon/recipes-bsp/u-boot/u-boot-ota.inc
---
 classes/image_type_tezi.bbclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/classes/image_type_tezi.bbclass b/classes/image_type_tezi.bbclass
index 1f96f83..c7aac1f 100644
--- a/classes/image_type_tezi.bbclass
+++ b/classes/image_type_tezi.bbclass
@@ -409,14 +409,20 @@ IMAGE_CMD:teziimg () {
                curl -k --retry 5 -O ${TEZI_EULA_URL} || true
        fi
 
+        local outfile stdoutfile
+        outfile=${TEZI_IMAGE_NAME}-Tezi_${TEZI_VERSION}.tar
+        stdoutfile=${TEZI_IMAGE_NAME}-Tezi.tar
+
        # The first transform strips all folders from the files to tar, the
        # second transform "moves" them in a subfolder ${TEZI_IMAGE_NAME}-Tezi_${TEZI_VERSION}.
        ${IMAGE_CMD_TAR} \
                --transform='s/.*\///' \
                --transform 's,^,${TEZI_IMAGE_NAME}-Tezi_${TEZI_VERSION}/,' \
-               -chf ${IMGDEPLOYDIR}/${TEZI_IMAGE_NAME}-Tezi_${TEZI_VERSION}.tar \
+               -chf "${IMGDEPLOYDIR}/${outfile}" \
                toradexlinux.png marketing.tar prepare.sh wrapup.sh ${TEZI_EULA_FILE} \
                ${WORKDIR}/image-json/image.json ${TEZI_ARTIFACTS}
+
+        ln -sf "${outfile}" "${IMGDEPLOYDIR}/${stdoutfile}"
 }
 do_image_teziimg[dirs] += "${WORKDIR}/image-json ${DEPLOY_DIR_IMAGE}"
 do_image_teziimg[cleandirs] += "${WORKDIR}/image-json"
-- 
2.39.2

Hi @matthijs !

Thanks a lot for your contribution!

This seems to be a nice idea :smiley:

I brought it up internally. We will let you know as soon as we have an update about it.

Have a great day!

1 Like

@henrique.tx Any progress on this? I’ve since discovered that torizoncore-builder does not handle symlinks to tarballs, so I proposed a fix for that here: images: Support symlinks to Tezi tarballs by matthijskooijman · Pull Request #13 · toradex/torizoncore-builder · GitHub

Hello @matthijs ,
According to our team the nightly images starting from january 10 should already have the symlink.

Best regards,
Josep

Ah, indeed, I see it is here: meta-toradex-bsp-common.git - Toradex BSP layer, recipes common to all modules in the master and kirkstone-6.x.y branches.

Thanks for merging!