public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v5 13/13] scripts: Add a script to generate kas yaml configs
Date: Tue, 26 Sep 2023 07:37:42 +0200	[thread overview]
Message-ID: <20230926053742.11352-14-ubely@ilbers.de> (raw)
In-Reply-To: <20230926053742.11352-1-ubely@ilbers.de>

The script simplifies generating YAML files for new distros,
images, machines and Isar packages and helps to avoid copy-paste
typos possible when using manual way.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 scripts/generate_yaml.sh | 97 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100755 scripts/generate_yaml.sh

diff --git a/scripts/generate_yaml.sh b/scripts/generate_yaml.sh
new file mode 100755
index 00000000..e17d6d3d
--- /dev/null
+++ b/scripts/generate_yaml.sh
@@ -0,0 +1,97 @@
+#!/usr/bin/env bash
+
+# This software is a part of ISAR.
+# Copyright (c) 2023 ilbers GmbH
+# Authors:
+#  Uladzimir Bely <ubely@ilbers.de>
+
+#
+# Script to generate yaml files for kas configuration
+#
+
+set -e
+
+cd "$(dirname "$0")/.."
+
+HEADER="\
+# This software is a part of ISAR.
+# Copyright (C) 2023 ilbers GmbH
+
+header:
+  version: 14"
+
+# Scan for distro configs, except "debian-common" used only for including
+
+DISTROS=$(find {meta,meta-isar}/conf/distro -iname *.conf -printf "%f\n" \
+  | sed -e 's/.conf$//' | grep -v "debian-common" | sort)
+
+for distro in ${DISTROS}
+do
+  cat << _EOF_ > kas/distro/${distro}.yaml
+${HEADER}
+
+distro: ${distro}
+_EOF_
+done
+
+# Scan for image recipes
+
+IMAGES=$(find {meta,meta-isar}/recipes-core/images -iname *.bb -printf "%f\n" \
+  | sed -e 's/.bb$//' | sort)
+
+for image in ${IMAGES}
+do
+  cat << _EOF_ > kas/image/${image}.yaml
+${HEADER}
+
+target: ${image}
+_EOF_
+done
+
+# Scan for machine configs, except "rpi-common" used only for including
+
+MACHINES=$(find meta-isar/conf/machine -iname *.conf -printf "%f\n" \
+  | sed -e 's/.conf$//' | grep -v "rpi-common" | sort)
+
+for machine in ${MACHINES}
+do
+  cat << _EOF_ > kas/machine/${machine}.yaml
+${HEADER}
+
+machine: ${machine}
+_EOF_
+done
+
+# Generate configs for fixed list of Isar packages
+
+PKGS=" \
+  cowsay \
+  enable-fsck \
+  example-module \
+  example-prebuilt \
+  example-raw \
+  expand-on-first-boot \
+  hello-isar \
+  hello \
+  isar-disable-apt-cache \
+  isar-exclude-docs \
+  kselftest \
+  samefile \
+  sshd-regen-keys \
+"
+for pkg in ${PKGS}
+do
+  package=${pkg}
+
+  if [ "${pkg}" == "example-module" ]; then
+    package=${pkg}-\$\{KERNEL_NAME\}
+  fi
+
+  cat << _EOF_ > kas/package/pkg_${pkg}.yaml
+${HEADER}
+
+local_conf_header:
+  package-${pkg}: |
+    IMAGE_INSTALL:append = " ${package}"
+_EOF_
+done
-- 
2.20.1


  parent reply	other threads:[~2023-09-26  5:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26  5:37 [PATCH v5 00/13] Support building Isar using kas Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 01/13] kas: Add initial Kconfig support Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 02/13] kas: Add a local copy of kas-container script Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 03/13] kas: Add mirror selection Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 04/13] kas: Add packages selection Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 05/13] kas: Add COMPAT_ARCH support Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 06/13] kas: Add cross compilation mode selection support Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 07/13] kas: Add ccache option Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 08/13] kas: Add image type selection Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 09/13] kas: Add IMAGE_FSTYPES selection Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 10/13] kas: Support CACHE_DEB_SRC option in menu Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 11/13] kas: Add options to activate predefined users Uladzimir Bely
2023-09-26  5:37 ` [PATCH v5 12/13] kas: Add kas/README.md Uladzimir Bely
2023-09-26  5:37 ` Uladzimir Bely [this message]
2023-09-29  6:53 ` [PATCH v5 00/13] Support building Isar using kas Uladzimir Bely

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=20230926053742.11352-14-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --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