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-base: Remove newly deployed debs from buildchroots
Date: Wed, 3 Jun 2020 09:37:10 +0200	[thread overview]
Message-ID: <2d755c85-4b38-dd1c-7450-d40dd7cda7ce@siemens.com> (raw)

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

This ensures clean reinstallation after partial rebuilds.

A typical error pattern so far was that firmware packages pulled by the
buildchroot-target were not updated there on rebuilds, causing the old
firmware being deployed into the image.

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

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 9aa2d546..80da713d 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -154,20 +154,26 @@ python do_dpkg_build() {
 
 addtask dpkg_build before do_build
 
-CLEANFUNCS += "repo_clean"
+CLEANFUNCS += "deb_clean"
 
-repo_clean() {
+deb_clean() {
     DEBS=$( find ${S}/.. -maxdepth 1 -name "*.deb" || [ ! -d ${S} ] )
     if [ -n "${DEBS}" ]; then
         for d in ${DEBS}; do
             repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
                 "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${d}"
+            package=$(basename "${d}")
+            package_remove="/usr/bin/apt-get remove -y -U ${package%%_*}"
+            sudo -E chroot ${BUILDCHROOT_DIR} ${package_remove} || true
+            if [ "${BUILDCHROOT_DIR}" != "${BUILDCHROOT_TARGET_DIR}" ]; then
+                    sudo -E chroot ${BUILDCHROOT_TARGET_DIR} ${package_remove} || true
+            fi
         done
     fi
 }
 
 do_deploy_deb() {
-    repo_clean
+    deb_clean
     repo_add_packages "${REPO_ISAR_DIR}"/"${DISTRO}" \
         "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" ${S}/../*.deb
 }
-- 
2.26.2

             reply	other threads:[~2020-06-03  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  7:37 Jan Kiszka [this message]
2020-08-07  9:34 ` Harald Seiler
2020-08-11  6:57   ` Jan Kiszka

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=2d755c85-4b38-dd1c-7450-d40dd7cda7ce@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