public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH v5 4/9] imager: Split imager deps between image types
Date: Wed, 31 May 2023 14:12:31 +0300	[thread overview]
Message-ID: <20230531111236.104373-5-amikan@ilbers.de> (raw)
In-Reply-To: <20230531111236.104373-1-amikan@ilbers.de>

To reduce dependencies install time and disk space consumption we need
to install only those imager dependencies which used in every image
type prepare logic. So split variables between tasks.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta/classes/image-tools-extension.bbclass | 10 ++++++----
 meta/classes/image.bbclass                 |  8 ++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
index 04ed1f84..58799fcf 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -15,6 +15,8 @@ SCHROOT_MOUNTS = "${WORKDIR}:${PP_WORK} ${IMAGE_ROOTFS}:${PP_ROOTFS} ${DEPLOY_DI
 SCHROOT_MOUNTS += "${REPO_ISAR_DIR}/${DISTRO}:/isar-apt"
 
 imager_run() {
+    local_install="${@(d.getVar("INSTALL_%s" % d.getVar("BB_CURRENTTASK")) or '').strip()}"
+
     schroot_create_configs
     insert_mounts
 
@@ -34,8 +36,8 @@ imager_run() {
     trap 'exit 1' INT HUP QUIT TERM ALRM USR1
     trap 'imager_cleanup' EXIT
 
-    if [ -n "${@d.getVar("IMAGER_INSTALL").strip()}" ]; then
-        echo "Installing deps: ${IMAGER_INSTALL}"
+    if [ -n "${local_install}" ]; then
+        echo "Installing imager deps: ${local_install}"
 
         distro="${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
         if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
@@ -64,13 +66,13 @@ EOF"
                 -o APT::Get::List-Cleanup='0'
             apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
                 --allow-unauthenticated --allow-downgrades --download-only install \
-                ${IMAGER_INSTALL}"
+                ${local_install}"
 
         deb_dl_dir_export ${schroot_dir} ${distro}
         schroot -r -c ${session_id} -d / -u root -- sh -c " \
             apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
                 --allow-unauthenticated --allow-downgrades install \
-                ${IMAGER_INSTALL}"
+                ${local_install}"
     fi
 
     schroot -r -c ${session_id} "$@"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 42e4b0c9..b9d3d411 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -208,6 +208,8 @@ python() {
     imager_build_deps = set()
     conversion_install = set()
     for bt in basetypes:
+        local_imager_install = set()
+        local_conversion_install = set()
         vardeps = set()
         cmds = []
         bt_clean = bt.replace('-', '_').replace('.', '_')
@@ -231,6 +233,7 @@ python() {
         # imager install
         for dep in (d.getVar('IMAGER_INSTALL:' + bt_clean) or '').split():
             imager_install.add(dep)
+            local_imager_install.add(dep)
         for dep in (d.getVar('IMAGER_BUILD_DEPS:' + bt_clean) or '').split():
             imager_build_deps.add(dep)
 
@@ -273,6 +276,7 @@ python() {
                     vardeps.add('CONVERSION_CMD:' + c)
                     for dep in (localdata.getVar('CONVERSION_DEPS:' + c) or '').split():
                         conversion_install.add(dep)
+                        local_conversion_install.add(dep)
                     # remove temporary image files
                     if t not in image_types:
                         rm_images.add(localdata.expand('${IMAGE_FILE_HOST}'))
@@ -305,6 +309,10 @@ python() {
             d.appendVarFlag(task, 'depends', task_deps)
         bb.build.addtask(task, 'do_image', after, d)
 
+        # set per type imager dependencies
+        d.setVar('INSTALL_image_%s' % bt_clean, d.getVar('IMAGER_INSTALL'))
+        d.appendVar('INSTALL_image_%s' % bt_clean, ' ' + ' '.join(sorted(local_imager_install | local_conversion_install)))
+
     d.appendVar('IMAGER_INSTALL', ' ' + ' '.join(sorted(imager_install | conversion_install)))
     d.appendVar('IMAGER_BUILD_DEPS', ' ' + ' '.join(sorted(imager_build_deps)))
 }
-- 
2.34.1


  parent reply	other threads:[~2023-05-31 11:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 11:12 [PATCH v5 0/9] Imager schroot migration Anton Mikanovich
2023-05-31 11:12 ` [PATCH v5 1/9] isar-apt: Move cleanup to postprocessing Anton Mikanovich
2023-05-31 11:12 ` [PATCH v5 2/9] imager: Migrate from buildchroot to schroot Anton Mikanovich
2023-05-31 11:12 ` [PATCH v5 3/9] imager: Move image types " Anton Mikanovich
2023-05-31 11:12 ` Anton Mikanovich [this message]
2023-05-31 11:12 ` [PATCH v5 5/9] CI: Fix used chroot recipe name Anton Mikanovich
2023-05-31 11:12 ` [PATCH v5 6/9] meta: Remove buildchroot Anton Mikanovich
2023-05-31 11:12 ` [PATCH v5 7/9] dpkg-gbp: Remove unused mounts Anton Mikanovich
2023-05-31 11:12 ` [PATCH v5 8/9] doc: Update chroot documentation Anton Mikanovich
2023-05-31 11:12 ` [PATCH v5 9/9] RECIPE-API-CHANGELOG.md: Describe imager changes Anton Mikanovich
2023-07-13 13:33 ` [PATCH v5 0/9] Imager schroot migration 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=20230531111236.104373-5-amikan@ilbers.de \
    --to=amikan@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