From: "srinuvasan.a via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: srinuvasan <srinuvasan.a@siemens.com>
Subject: [PATCH] testsuite/cibuilder: Consolidate writes to ci_build.conf
Date: Thu, 14 Aug 2025 13:24:34 +0530 [thread overview]
Message-ID: <20250814075434.3410073-1-srinuvasan.a@siemens.com> (raw)
From: srinuvasan <srinuvasan.a@siemens.com>
Perform a single write to ci_build.conf rather than multiple per-condition writes,
resulting in fewer I/O calls and a small performance gain.
Apply f-strings only where variable interpolation is needed.
Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
---
testsuite/cibuilder.py | 62 ++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 26 deletions(-)
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 7d702b35..cd5e70ba 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -178,25 +178,29 @@ class CIBuilder(Test):
# write ci_build.conf
with open(self.build_dir + '/conf/ci_build.conf', 'w') as f:
if compat_arch:
- f.write('ISAR_ENABLE_COMPAT_ARCH:amd64 = "1"\n')
- f.write('IMAGE_INSTALL:remove:amd64 = "hello-isar"\n')
- f.write('IMAGE_INSTALL:append:amd64 = " hello-isar-compat"\n')
- f.write('ISAR_ENABLE_COMPAT_ARCH:arm64 = "1"\n')
- f.write('IMAGE_INSTALL:remove:arm64 = "hello-isar"\n')
- f.write('IMAGE_INSTALL:append:arm64 = " hello-isar-compat"\n')
+ f.write(
+ 'ISAR_ENABLE_COMPAT_ARCH:amd64 = "1"\n'
+ 'IMAGE_INSTALL:remove:amd64 = "hello-isar"\n'
+ 'IMAGE_INSTALL:append:amd64 = " hello-isar-compat"\n'
+ 'ISAR_ENABLE_COMPAT_ARCH:arm64 = "1"\n'
+ 'IMAGE_INSTALL:remove:arm64 = "hello-isar"\n'
+ 'IMAGE_INSTALL:append:arm64 = " hello-isar-compat"\n'
+ )
if not cross:
f.write('ISAR_CROSS_COMPILE = "0"\n')
else:
- f.write('ISAR_CROSS_COMPILE = "1"\n')
f.write(
+ 'ISAR_CROSS_COMPILE = "1"\n'
'IMAGE_INSTALL:append:hikey = '
'" linux-headers-${KERNEL_NAME}"\n'
)
if debsrc_cache:
f.write('BASE_REPO_FEATURES = "cache-deb-src"\n')
if offline:
- f.write('ISAR_USE_CACHED_BASE_REPO = "1"\n')
- f.write('BB_NO_NETWORK = "1"\n')
+ f.write(
+ 'ISAR_USE_CACHED_BASE_REPO = "1"\n'
+ 'BB_NO_NETWORK = "1"\n'
+ )
if container:
f.write('SDK_FORMATS = "docker-archive"\n')
if gpg_pub_key:
@@ -206,8 +210,10 @@ class CIBuilder(Test):
if distro_apt_premir:
f.write('DISTRO_APT_PREMIRRORS = "%s"\n' % distro_apt_premir)
if ccache:
- f.write('USE_CCACHE = "1"\n')
- f.write('CCACHE_TOP_DIR = "%s"\n' % ccache_dir)
+ f.write(
+ 'USE_CCACHE = "1"\n'
+ 'CCACHE_TOP_DIR = "%s"\n' % ccache_dir
+ )
if source_date_epoch:
f.write(
'SOURCE_DATE_EPOCH_FALLBACK = "%s"\n' % source_date_epoch
@@ -229,24 +235,28 @@ class CIBuilder(Test):
size = 4294967296 # 4GiB should be enough for the target
wic.write("\0" * size)
- f.write('BBMULTICONFIG += "isar-installer installer-target"\n')
- f.write('INSTALLER_UNATTENDED = "1"\n')
- f.write('INSTALLER_TARGET_OVERWRITE = "OVERWRITE"\n')
- f.write(f'INSTALLER_TARGET_IMAGE = "{installer_image}"\n')
- f.write(f'INSTALLER_TARGET_DEVICE = "{installer_device}"\n')
- f.write(f'DISTRO ?= "{installer_distro}"\n')
- f.write(f'MACHINE ?= "{installer_machine}"\n')
- f.write(f'QEMU_DISK_ARGS = "-bios /usr/share/ovmf/OVMF.fd"\n')
- f.write(f'QEMU_DISK_ARGS += "-drive file={install_target},'\
- 'if=ide,bus=0,unit=0,format=raw,snapshot=off"\n')
- f.write(f'QEMU_DISK_ARGS += "-hdb ##ROOTFS_IMAGE##"\n')
+ f.write(
+ 'BBMULTICONFIG += "isar-installer installer-target"\n'
+ 'INSTALLER_UNATTENDED = "1"\n'
+ 'INSTALLER_TARGET_OVERWRITE = "OVERWRITE"\n'
+ f'INSTALLER_TARGET_IMAGE = "{installer_image}"\n'
+ f'INSTALLER_TARGET_DEVICE = "{installer_device}"\n'
+ f'DISTRO ?= "{installer_distro}"\n'
+ f'MACHINE ?= "{installer_machine}"\n'
+ 'QEMU_DISK_ARGS = "-bios /usr/share/ovmf/OVMF.fd"\n'
+ f'QEMU_DISK_ARGS += "-drive file={install_target},'\
+ 'if=ide,bus=0,unit=0,format=raw,snapshot=off"\n'
+ 'QEMU_DISK_ARGS += "-hdb ##ROOTFS_IMAGE##"\n'
+ )
if customizations is not None:
if not isinstance(customizations, str):
customizations = ' '.join(customizations)
- f.write('CUSTOMIZATIONS = "%s"\n' % customizations)
- f.write('CUSTOMIZATION_VARS:append = " ${IMAGE}"\n')
- f.write('CUSTOMIZATION_FOR_IMAGES:append = " isar-image-ci"\n')
- f.write('HOSTNAME:isar-image-ci = "isar-ci"\n')
+ f.write(
+ f'CUSTOMIZATIONS = "{customizations}"\n'
+ 'CUSTOMIZATION_VARS:append = " ${IMAGE}"\n'
+ 'CUSTOMIZATION_FOR_IMAGES:append = " isar-image-ci"\n'
+ 'HOSTNAME:isar-image-ci = "isar-ci"\n'
+ )
if lines is not None:
f.writelines((line + '\n' if not line.endswith('\n') else line) for line in lines)
--
2.39.5
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250814075434.3410073-1-srinuvasan.a%40siemens.com.
next reply other threads:[~2025-08-14 7:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 7:54 srinuvasan.a via isar-users [this message]
2025-09-12 9:15 ` Anton Mikanovich
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=20250814075434.3410073-1-srinuvasan.a@siemens.com \
--to=isar-users@googlegroups.com \
--cc=srinuvasan.a@siemens.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