public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/1] dpkg: directly deploy via sstate cache
Date: Tue,  7 Jul 2026 11:09:41 +0200	[thread overview]
Message-ID: <20260707090941.2667874-1-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <ac2f7d165688d3fc8c20cadbdfb0160e1763ed2a.camel@siemens.com>

By that, we can get rid of the custom sstate logic, which should be
avoided if not needed. Further, the deploy process is now cleaner, as we
deploy from a dedicated dir instead of the WORKDIR.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 doc/technical_overview.md             |  2 +-
 meta/classes-recipe/dpkg-base.bbclass | 37 +++++++++------------------
 2 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/doc/technical_overview.md b/doc/technical_overview.md
index f7e00f7b..fe427cae 100644
--- a/doc/technical_overview.md
+++ b/doc/technical_overview.md
@@ -217,7 +217,7 @@ Both consist of the following steps:
    finally unmount again (`dpkg_undo_mounts`).
 
 6. Task `do_deploy_deb`: add successfully built packages
-   `${WORKDIR}/*.deb` to the isar-apt repository
+   `${DEPLOYDIR}/*.deb` to the isar-apt repository
    `${REPO_ISAR_DIR}/${DISTRO}`
 
 ## 3.6 Populate Target Filesystem
diff --git a/meta/classes-recipe/dpkg-base.bbclass b/meta/classes-recipe/dpkg-base.bbclass
index 153b91c4..1a1d8da7 100644
--- a/meta/classes-recipe/dpkg-base.bbclass
+++ b/meta/classes-recipe/dpkg-base.bbclass
@@ -12,6 +12,8 @@ inherit repository
 inherit deb-dl-dir
 inherit essential
 
+DEPLOYDIR = "${WORKDIR}/deploy"
+
 DEPENDS ?= ""
 RPROVIDES ?= "${PROVIDES}"
 
@@ -186,6 +188,10 @@ dpkg_prepare_unshare_ccache() {
     setfacl -m u:${UNSHARE_SUBUID_BASE}:rwX -m u:${@int(d.getVar('UNSHARE_SUBUID_BASE')) + 999}:rwx "${CCACHE_DIR}"
 }
 
+dpkg_collect_debs() {
+    find ${WORKDIR} -maxdepth 1 -name "*.deb" -exec mv {} ${DEPLOYDIR} \;
+}
+
 python do_dpkg_build() {
     bb.build.exec_func('dpkg_chroot_prepare', d)
     try:
@@ -193,45 +199,26 @@ python do_dpkg_build() {
     finally:
         bb.build.exec_func('dpkg_chroot_finalize', d)
 }
+do_dpkg_build[cleandirs] = "${DEPLOYDIR}"
+do_dpkg_build[sstate-plaindirs] = "${DEPLOYDIR}"
 do_dpkg_build[network] = "${TASK_USE_NETWORK_AND_SUDO}"
+do_dpkg_build[depends] = "${SCHROOT_DEP}"
+do_dpkg_build[postfuncs] += "dpkg_collect_debs"
 
 addtask dpkg_build
 
 SSTATETASKS += "do_dpkg_build"
-SSTATECREATEFUNCS += "dpkg_build_sstate_prepare"
-SSTATEPOSTINSTFUNCS += "dpkg_build_sstate_finalize"
-
-dpkg_build_sstate_prepare() {
-    [ "${SSTATE_CURRTASK}" = "dpkg_build" ] || return 0
-
-    # this runs in SSTATE_BUILDDIR, which will be deleted automatically
-    if [ -n "$(find ${WORKDIR} -maxdepth 1 -name '*.deb' -print -quit)" ]; then
-        cp -f ${WORKDIR}/*.deb -t .
-    fi
-}
-
-dpkg_build_sstate_finalize() {
-    [ "${SSTATE_CURRTASK}" = "dpkg_build" ] || return 0
-
-    # this runs in SSTATE_INSTDIR
-    if [ -n "$(find . -maxdepth 1 -name '*.deb' -print -quit)" ]; then
-        mv -f ./*.deb -t ${WORKDIR}/
-    fi
-}
 
 python do_dpkg_build_setscene() {
     sstate_setscene(d)
 }
 
 addtask dpkg_build_setscene
-do_dpkg_build_setscene[dirs] += "${S}/.."
-
-do_dpkg_build[depends] = "${SCHROOT_DEP}"
 
 CLEANFUNCS += "deb_clean"
 
 deb_clean() {
-    DEBS=$( find ${WORKDIR} -maxdepth 1 -name "*.deb" || [ ! -d ${S} ] )
+    DEBS=$( find ${DEPLOYDIR} -maxdepth 1 -name "*.deb" || [ ! -d ${S} ] )
     if [ -n "${DEBS}" ]; then
         for d in ${DEBS}; do
             repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
@@ -246,7 +233,7 @@ do_clean[network] = "${TASK_USE_SUDO}"
 do_deploy_deb() {
     deb_clean
     repo_add_packages "${REPO_ISAR_DIR}"/"${DISTRO}" \
-        "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" ${WORKDIR}/*.deb
+        "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" ${DEPLOYDIR}/*.deb
 }
 
 addtask deploy_deb after do_dpkg_build before do_build
-- 
2.53.0

-- 
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/20260707090941.2667874-1-felix.moessbauer%40siemens.com.

  reply	other threads:[~2026-07-07  9:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 15:08 [PATCH v12 0/3] Move kernel artifacts deployment from image recipe Anton Mikanovich
2026-07-03 15:08 ` [PATCH v12 1/3] meta: Fix do_copy_boot_files error for different distros of same machine Anton Mikanovich
2026-07-03 15:08 ` [PATCH v12 2/3] meta: Move kernel artifacts deployment from image recipe Anton Mikanovich
2026-07-07  9:06   ` 'MOESSBAUER, Felix' via isar-users
2026-07-07  9:09     ` 'Felix Moessbauer' via isar-users [this message]
2026-07-03 15:08 ` [PATCH v12 3/3] CI: Check kernel artifacts deployment Anton Mikanovich
2026-07-07  9:52 ` [PATCH v12 0/3] Move kernel artifacts deployment from image recipe 'Quirin Gylstorff' via isar-users
2026-07-07 11:11   ` '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=20260707090941.2667874-1-felix.moessbauer@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=felix.moessbauer@siemens.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