public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "srinuvasan.a via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: cedric.hombourger@siemens.com, ubely@ilbers.de,
	srinuvasan <srinuvasan.a@siemens.com>
Subject: [PATCH 2/3] image: download deb-src packages after imager creation
Date: Wed,  5 Mar 2025 19:55:12 +0530	[thread overview]
Message-ID: <20250305142513.1841415-2-srinuvasan.a@siemens.com> (raw)
In-Reply-To: <20250305142513.1841415-1-srinuvasan.a@siemens.com>

From: srinuvasan <srinuvasan.a@siemens.com>

With the present implementation, deb-src packages are missing for imager related
deb packages (packages listed in IMAGER_INSTALL).
Copy the /var/log/dpkg.log file from the sbuild environment to outside
With that, use the list to download deb-src packages for IMAGER_INSTALL
related deb packages.

Presently, cache_deb_src function running as part of ROOTFS_POSTPROCESS_COMMAND,
this will not be helpful to get the imager related deb-src packages, hence
make cache_deb_src as a separate task and running
always after do_image to get the imager deps related deb-src packages.

Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
---
 meta/classes/image-tools-extension.bbclass | 8 +++++++-
 meta/classes/image.bbclass                 | 8 +++++++-
 meta/classes/rootfs.bbclass                | 3 ++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
index e8ace8f5..156dfcb3 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -7,6 +7,9 @@
 
 inherit sbuild
 
+PP = "/home/builder/${PN}-${MACHINE}"
+ext_root="${PP}/rootfs"
+
 IMAGER_INSTALL ??= ""
 IMAGER_BUILD_DEPS ??= ""
 DEPENDS += "${IMAGER_BUILD_DEPS}"
@@ -59,9 +62,11 @@ EOAPT
 
         deb_dl_dir_export ${schroot_dir} ${distro}
         schroot -r -c ${session_id} -d / -u root -- sh -c " \
+            rm -f /var/log/dpkg.log
             apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \
                 --allow-unauthenticated --allow-downgrades install \
-                ${local_install}"
+                ${local_install}
+            cp /var/log/dpkg.log ${ext_root}/dpkg_partial.log"
     fi
 
     schroot -r -c ${session_id} "$@"
@@ -70,4 +75,5 @@ EOAPT
 
     remove_mounts
     schroot_delete_configs
+    sbuild_dpkg_log_export "${WORKDIR}/rootfs/dpkg_partial.log"
 }
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 56eca202..66b4d313 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -72,7 +72,13 @@ ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
 ROOTFS_DPKGSTATUS_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
 ROOTFS_PACKAGE_SUFFIX ?= "${PN}-${DISTRO}-${MACHINE}"
 
-ROOTFS_POSTPROCESS_COMMAND:prepend = "${@bb.utils.contains('BASE_REPO_FEATURES', 'cache-deb-src', 'cache_deb_src', '', d)} "
+CACHE_DEB_SRC = "${@bb.utils.contains('BASE_REPO_FEATURES', 'cache-deb-src', '1', '0', d)}"
+
+python () {
+    if bb.utils.to_boolean(d.getVar('CACHE_DEB_SRC')):
+        bb.build.addtask('do_cache_deb_src', 'do_deploy', 'do_image', d)
+}
+
 
 inherit rootfs
 inherit sdk
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 205da640..b9d360e7 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -272,7 +272,8 @@ python do_rootfs_install() {
 }
 addtask rootfs_install before do_rootfs_postprocess after do_unpack
 
-cache_deb_src() {
+do_cache_deb_src[network] = "${TASK_USE_SUDO}"
+do_cache_deb_src() {
     if [ -e "${ROOTFSDIR}"/etc/resolv.conf ] ||
        [ -h "${ROOTFSDIR}"/etc/resolv.conf ]; then
         sudo mv "${ROOTFSDIR}"/etc/resolv.conf "${ROOTFSDIR}"/etc/resolv.conf.isar
-- 
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/20250305142513.1841415-2-srinuvasan.a%40siemens.com.

  reply	other threads:[~2025-03-05 14:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 14:25 [PATCH 1/3] mmdebstrap: add "skip=cleanup/reproducible" option to mmdebstrap srinuvasan.a via isar-users
2025-03-05 14:25 ` srinuvasan.a via isar-users [this message]
2025-03-06  6:05   ` [PATCH 2/3] image: download deb-src packages after imager creation Uladzimir Bely
2025-03-06  6:10     ` 'Arjunan, Srinu' via isar-users
2025-03-07 12:25     ` [PATCH v2 1/3] mmdebstrap: add "skip=cleanup/reproducible" option to mmdebstrap srinuvasan.a via isar-users
2025-03-07 12:25       ` [PATCH v2 2/3] image: download deb-src packages after imager creation srinuvasan.a via isar-users
2025-03-07 12:25       ` [PATCH v2 3/3] image: disable clean-log-files ROOTFS_FEATURES for deb-src caching srinuvasan.a via isar-users
2025-03-07 21:59       ` [PATCH v2 1/3] mmdebstrap: add "skip=cleanup/reproducible" option to mmdebstrap 'Jan Kiszka' via isar-users
2025-03-08 13:44         ` 'cedric.hombourger@siemens.com' via isar-users
2025-03-08 18:25           ` 'Arjunan, Srinu' via isar-users
2025-03-08 19:15             ` 'cedric.hombourger@siemens.com' via isar-users
2025-03-09  8:46               ` 'Arjunan, Srinu' via isar-users
2025-03-10  9:14                 ` 'cedric.hombourger@siemens.com' via isar-users
2025-03-10 12:01                   ` 'Arjunan, Srinu' via isar-users
2025-03-08 19:20             ` 'cedric.hombourger@siemens.com' via isar-users
2025-03-08 18:20         ` Srinuvasan Arjunan
2025-03-05 14:25 ` [PATCH 3/3] image: disable clean-log-files ROOTFS_FEATURES for deb-src caching srinuvasan.a via isar-users
2025-03-05 14:40 ` [PATCH 1/3] mmdebstrap: add "skip=cleanup/reproducible" option to mmdebstrap 'Jan Kiszka' via isar-users
2025-03-06  6:08   ` 'Arjunan, Srinu' via isar-users
2025-03-06  8:20     ` 'Jan Kiszka' via isar-users

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=20250305142513.1841415-2-srinuvasan.a@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=srinuvasan.a@siemens.com \
    --cc=ubely@ilbers.de \
    /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