public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH 2/5] image: Add imager dependency installation task
Date: Wed,  5 Sep 2018 20:18:01 +0200	[thread overview]
Message-ID: <ab359183f3e4d94b2c6a050ca20d159b77702bbe.1536171484.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1536171484.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1536171484.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

This adds a way to install dependencies of an imager like wic after
rootfs creation. The interface consists of the to be installed packages
(IMAGER_INSTALL) as well as potential recipe dependencies
(IMAGER_BUILD_DEPS).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/classes/image.bbclass | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 6a5f0e9..d7f71e3 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -104,3 +104,37 @@ do_populate_sdk[stamp-extra-info] = "${MACHINE}-${DISTRO}"
 do_populate_sdk[depends] = "sdkchroot:do_build"
 
 addtask populate_sdk after do_rootfs
+
+# Imager are expected to run natively, thus will use the target buildchroot.
+ISAR_CROSS_COMPILE = "0"
+
+inherit buildchroot
+
+IMAGER_INSTALL ??= ""
+IMAGER_BUILD_DEPS ??= ""
+DEPENDS += "${IMAGER_BUILD_DEPS}"
+
+do_install_imager_deps() {
+    if [ -z "${@d.getVar("IMAGER_INSTALL", True).strip()}" ]; then
+        exit
+    fi
+
+    buildchroot_do_mounts
+
+    E="${@bb.utils.export_proxies(d)}"
+    sudo -E chroot ${BUILDCHROOT_DIR} sh -c ' \
+        apt-get update \
+            -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \
+            -o Dir::Etc::sourceparts="-" \
+            -o APT::Get::List-Cleanup="0"
+        apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
+            --allow-unauthenticated install \
+            ${IMAGER_INSTALL}'
+}
+
+do_install_imager_deps[depends] = "buildchroot-target:do_build"
+do_install_imager_deps[deptask] = "do_deploy_deb"
+do_install_imager_deps[lockfiles] += "${DEPLOY_DIR_APT}/isar.lock"
+do_install_imager_deps[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+
+addtask install_imager_deps before do_build
-- 
2.16.4


  parent reply	other threads:[~2018-09-05 18:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 18:17 [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
2018-09-05 18:18 ` [PATCH 1/5] meta: Factor out buildchroot class Jan Kiszka
2018-09-05 18:18 ` Jan Kiszka [this message]
2018-09-05 18:18 ` [PATCH 3/5] wic-img: Require explicit setting of WKS_FILE Jan Kiszka
2018-09-05 18:18 ` [PATCH 4/5] Install wic and bootloader dependencies via imager_install_deps Jan Kiszka
2018-09-05 18:18 ` [PATCH 5/5] meta: Add custom U-Boot recipe include Jan Kiszka
2018-09-07 18:27   ` [PATCH v2 " Jan Kiszka
2018-09-05 18:19 ` [PATCH 0/5] Refactor bootloader installation, add custom U-Boot include Jan Kiszka
2018-09-11  8:33 ` Maxim Yu. Osipov

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=ab359183f3e4d94b2c6a050ca20d159b77702bbe.1536171484.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@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