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 v3 4/6] imager: Split imager deps between image types
Date: Mon, 13 Feb 2023 09:40:32 +0200	[thread overview]
Message-ID: <20230213074034.3949-5-amikan@ilbers.de> (raw)
In-Reply-To: <20230213074034.3949-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 640c56c..4c7ba55 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -18,6 +18,8 @@ imager_run() {
     schroot_create_configs
     insert_mounts
 
+    local_install="${@(d.getVar("INSTALL_%s" % d.getVar("BB_CURRENTTASK"), True) or '').strip()}"
+
     session_id=$(schroot -q -b -c ${SBUILD_CHROOT})
     echo "Started session: ${session_id}"
 
@@ -31,8 +33,8 @@ imager_run() {
     trap 'exit 1' INT HUP QUIT TERM ALRM USR1
     trap 'imager_cleanup' EXIT
 
-    if [ -n "${@d.getVar("IMAGER_INSTALL", True).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
@@ -61,13 +63,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 146d69e..34b1d61 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -202,6 +202,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('.', '_')
@@ -225,6 +227,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)
 
@@ -267,6 +270,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}'))
@@ -299,6 +303,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-02-13  7:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13  7:40 [PATCH v3 0/6] Imager schroot migration Anton Mikanovich
2023-02-13  7:40 ` [PATCH v3 1/6] isar-apt: Move cleanup to postprocessing Anton Mikanovich
2023-02-13  7:40 ` [PATCH v3 2/6] imager: Migrate from buildchroot to schroot Anton Mikanovich
2023-02-13  7:40 ` [PATCH v3 3/6] imager: Move image types " Anton Mikanovich
2023-02-13  7:40 ` Anton Mikanovich [this message]
2023-02-13  7:40 ` [PATCH v3 5/6] CI: Fix used chroot recipe name Anton Mikanovich
2023-02-14  9:28   ` Schmidt, Adriaan
2023-02-14 10:30     ` Anton Mikanovich
2023-02-13  7:40 ` [PATCH v3 6/6] meta: Remove buildchroot 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=20230213074034.3949-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