From: Henning Schild <henning.schild@siemens.com>
To: <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH v4 6/7] vm-img: Make use of isars template class for most of the tmpl variables.
Date: Wed, 15 Dec 2021 16:48:43 +0100 [thread overview]
Message-ID: <20211215154844.1495-7-henning.schild@siemens.com> (raw)
In-Reply-To: <20211215154844.1495-1-henning.schild@siemens.com>
The vm-img class used to envsubst everything itself, but doing so with
the templating mechanism of isar is probably better, also to cover
variable depends.
But we stick with a second run of envsubst for variables where the
content needs to be discovered/calculated.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/vm-img.bbclass | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/meta/classes/vm-img.bbclass b/meta/classes/vm-img.bbclass
index c189e67fea1c..1c36e72b262d 100644
--- a/meta/classes/vm-img.bbclass
+++ b/meta/classes/vm-img.bbclass
@@ -67,20 +67,9 @@ OVA_VARS = "OVA_NAME OVA_MEMORY OVA_NUMBER_OF_CPU OVA_VRAM \
OVA_FIRMWARE OVA_ACPI OVA_3D_ACCEL \
OVA_SHA_ALG VIRTUAL_MACHINE_IMAGE_FILE"
-# the ovf template is updated with ensubst
-# this function adds the variable from OVA_VARS to the environment
-python update_environment() {
- template_vars = (d.getVar('OVA_VARS', True) or "").split()
- if len(template_vars) == 0:
- return
-
- for varname in template_vars:
- value = d.getVar(varname, True)
- if value:
- os.environ.update({varname: value})
-}
+TEMPLATE_FILES += "${OVF_TEMPLATE_FILE}"
+TEMPLATE_VARS += "${OVA_VARS}"
-do_create_ova[prefuncs] += "update_environment"
do_create_ova() {
if [ ! ${VIRTUAL_MACHINE_IMAGE_TYPE} = "vmdk" ]; then
exit 0
@@ -93,6 +82,7 @@ do_create_ova() {
export LAST_CHANGE=$(date -u "+%Y-%m-%dT%H:%M:%SZ")
export OVA_FIRMWARE_UPPERCASE=$(echo ${OVA_FIRMWARE} | tr '[a-z]' '[A-Z]')
+ export OVF_TEMPLATE_STAGE2=$(echo ${OVF_TEMPLATE_FILE} | sed 's/.tmpl$//' )
image_do_mounts
sudo -Es chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} <<'EOSUDO'
@@ -101,7 +91,7 @@ do_create_ova() {
export DISK_UUID=$(uuidgen)
export VM_UUID=$(uuidgen)
# create ovf
- cat ${PP_WORK}/${OVF_TEMPLATE_FILE} | envsubst > ${PP_DEPLOY}/${OVA_NAME}.ovf
+ cat ${PP_WORK}/${OVF_TEMPLATE_STAGE2} | envsubst > ${PP_DEPLOY}/${OVA_NAME}.ovf
tar -cvf ${PP_DEPLOY}/${OVA_NAME}.ova -C ${PP_DEPLOY} ${OVA_NAME}.ovf
# VirtualBox needs here a manifest file. VMware does accept that format.
--
2.32.0
next prev parent reply other threads:[~2021-12-15 15:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 15:48 [PATCH v4 0/7] vm-img improvements and fixes Henning Schild
2021-12-15 15:48 ` [PATCH v4 1/7] vm-img: Move template out of package into SRC_URI file Henning Schild
2021-12-15 15:48 ` [PATCH v4 2/7] vm-img: Use two different ovf templates for vmware/virtualbox Henning Schild
2021-12-15 15:48 ` [PATCH v4 3/7] vm-img: Shorten code by using variables we have Henning Schild
2021-12-15 15:48 ` [PATCH v4 4/7] vm-img: Drop not used variables Henning Schild
2021-12-15 15:48 ` [PATCH v4 5/7] vm-img: Set vmware machine type to 64bit in our template Henning Schild
2021-12-15 15:48 ` Henning Schild [this message]
2021-12-15 15:48 ` [PATCH v4 7/7] meta-isar: Switch virtualbox test from buster to bullseye Henning Schild
2021-12-15 15:50 ` [PATCH v4 0/7] vm-img improvements and fixes Henning Schild
2021-12-15 15:57 ` Jan Kiszka
2021-12-15 16:21 ` Anton Mikanovich
2021-12-15 16:35 ` Henning Schild
2021-12-16 13:23 ` Baurzhan Ismagulov
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=20211215154844.1495-7-henning.schild@siemens.com \
--to=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox