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] dpkg: Add control over removal of built packages
Date: Thu, 8 Oct 2020 19:13:31 +0200	[thread overview]
Message-ID: <76603767-1d25-c347-f7b1-84d4c106e771@siemens.com> (raw)

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

In almost all cases, the packages built by a recipe wasn't used yet and
will only be requested down the dependency chain. Then it is fine to
purge it from the buildchroots during partial rebuilds.

There are corner cases, though, when the packages will never be used in
the buildchroots, only in the target filesystem. That can affect core
packages rebuilt for the target but also used in their upstream variant
in the buildchroots. While buildchroot installation can be controlled
via preferences, purging can't this way. Add a variable that allows to
control it without having to overwrite deb_clean.

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

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 7e12ab0a..01c6eb65 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -154,6 +154,8 @@ python do_dpkg_build() {
 
 addtask dpkg_build before do_build
 
+KEEP_INSTALLED_ON_CLEAN ?= "0"
+
 CLEANFUNCS += "deb_clean"
 
 deb_clean() {
@@ -162,6 +164,9 @@ deb_clean() {
         for d in ${DEBS}; do
             repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
                 "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${d}"
+            if [ "${KEEP_INSTALLED_ON_CLEAN}" = "1" ]; then
+                continue;
+            fi
             package=$(basename "${d}")
             package_remove="/usr/bin/apt-get remove -y ${package%%_*}"
             sudo -E chroot ${BUILDCHROOT_DIR} ${package_remove} || true
-- 
2.26.2

             reply	other threads:[~2020-10-08 17:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 17:13 Jan Kiszka [this message]
2020-11-04  7:44 ` vijaikumar....@gmail.com
2020-11-21  7:43   ` Jan Kiszka
2020-11-26 15:47 ` 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=76603767-1d25-c347-f7b1-84d4c106e771@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