public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v2 1/1] sstate: do not keep intermediate sstate files
Date: Thu, 24 Feb 2022 08:36:29 +0100	[thread overview]
Message-ID: <20220224073629.23717-2-ubely@ilbers.de> (raw)
In-Reply-To: <20220224073629.23717-1-ubely@ilbers.de>

This saves about 2...5 GiB of disk space per multiconfig depending
on package list, cross-build mode, etc.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/classes/dpkg-base.bbclass                      | 7 +++++++
 meta/classes/rootfs.bbclass                         | 7 +++++++
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 7 +++++++
 3 files changed, 21 insertions(+)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 928856a9..b5090d13 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -253,6 +253,7 @@ dpkg_build_sstate_finalize() {
     if [ -n "$(find ${DPKG_SSTATE} -maxdepth 1 -name '*.deb' -print -quit)" ]; then
         ln -f ${DPKG_SSTATE}/*.deb -t ${S}/..
     fi
+    do_dpkg_build_sstate_cleanup
 }
 
 python do_dpkg_build_setscene() {
@@ -263,6 +264,12 @@ python do_dpkg_build_setscene() {
 addtask dpkg_build_setscene
 do_dpkg_build_setscene[dirs] += "${S}/.."
 
+do_dpkg_build_sstate_cleanup() {
+    rm -rf ${DPKG_SSTATE}
+}
+
+addtask dpkg_build_sstate_cleanup before do_build after do_dpkg_build
+
 KEEP_INSTALLED_ON_CLEAN ?= "0"
 
 CLEANFUNCS += "deb_clean"
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 2bdb3b6d..0c7b535c 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -305,6 +305,7 @@ do_rootfs_install_sstate_prepare[lockfiles] = "${REPO_ISAR_DIR}/isar.lock"
 
 rootfs_install_sstate_finalize() {
     sudo tar -C ${WORKDIR} -xpf ${ROOTFS_SSTATE}/rootfs.tar
+    do_rootfs_install_sstate_cleanup
 }
 
 python do_rootfs_install_setscene() {
@@ -312,3 +313,9 @@ python do_rootfs_install_setscene() {
     bb.build.exec_func('rootfs_install_sstate_finalize', d)
 }
 addtask do_rootfs_install_setscene
+
+do_rootfs_install_sstate_cleanup() {
+    rm -rf ${ROOTFS_SSTATE}
+}
+
+addtask rootfs_install_sstate_cleanup before do_rootfs_postprocess after do_rootfs_install
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 2f483f5a..16c04bf8 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -408,6 +408,7 @@ bootstrap_sstate_prepare() {
 bootstrap_sstate_finalize() {
     sudo tar -C $(dirname "${ROOTFSDIR}") -xpf ${BOOTSTRAP_SSTATE}/bootstrap.tar
     sudo ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}"
+    do_bootstrap_sstate_cleanup
 }
 
 python do_bootstrap_setscene() {
@@ -418,6 +419,12 @@ python do_bootstrap_setscene() {
 addtask do_bootstrap_setscene
 do_bootstrap_setscene[dirs] = "${DEPLOY_DIR_BOOTSTRAP}"
 
+do_bootstrap_sstate_cleanup() {
+    rm -rf ${BOOTSTRAP_SSTATE}
+}
+
+addtask bootstrap_sstate_cleanup before do_build after do_bootstrap
+
 CLEANFUNCS = "clean_deploy"
 clean_deploy() {
     rm -f "${DEPLOY_ISAR_BOOTSTRAP}"
-- 
2.20.1


  reply	other threads:[~2022-02-24  7:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24  7:36 [PATCH v2 0/1] " Uladzimir Bely
2022-02-24  7:36 ` Uladzimir Bely [this message]
2022-02-24  7:56 ` Schmidt, Adriaan
2022-02-24  8:19   ` Uladzimir Bely
2022-02-24  9:04     ` Schmidt, Adriaan
2022-02-24 15:57       ` Henning Schild

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=20220224073629.23717-2-ubely@ilbers.de \
    --to=ubely@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