[1/1] clean: allow to run cleanall after deleting build/tmp

Message ID 20261118155530.2968207-1-felix.moessbauer@siemens.com
State New
Headers show
Series [1/1] clean: allow to run cleanall after deleting build/tmp | expand

Commit Message

Felix Moessbauer Nov. 18, 2026, 3:55 p.m. UTC
When deleting the build/tmp (e.g. via a kas clean), a following
bitbake -c cleanall <recipe> fails because the isar apt no longer
exists. By that, the cleanall breaks and does not clean the downloaded
artifact. We now handle this case and just don't remove the .deb from
isar-apt (as isar-apt anyways is gone) and continue deleting the
archive.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes-recipe/dpkg-base.bbclass   | 2 ++
 meta/classes-recipe/dpkg-source.bbclass | 2 ++
 2 files changed, 4 insertions(+)

Patch

diff --git a/meta/classes-recipe/dpkg-base.bbclass b/meta/classes-recipe/dpkg-base.bbclass
index 4ec0ddbe..73238a66 100644
--- a/meta/classes-recipe/dpkg-base.bbclass
+++ b/meta/classes-recipe/dpkg-base.bbclass
@@ -237,6 +237,8 @@  CLEANFUNCS =+ "deb_clean"
 # dropped (instead of its variants)
 deb_clean() {
     [ -d "${DEPLOY_DIR_DEB}" ] || return 0
+    # isar-apt may not exist (yet), e.g. after removing the tmp directory
+    [ -f "${REPO_ISAR_DIR}/${DISTRO}/conf/distributions" ] || return 0
     for deb in $(find ${DEPLOY_DIR_DEB} -maxdepth 1 -name '*.deb'); do
         repo_del_package "${REPO_ISAR_DIR}"/"${DISTRO}" \
             "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${deb}"
diff --git a/meta/classes-recipe/dpkg-source.bbclass b/meta/classes-recipe/dpkg-source.bbclass
index 6f9091a8..7b4569dd 100644
--- a/meta/classes-recipe/dpkg-source.bbclass
+++ b/meta/classes-recipe/dpkg-source.bbclass
@@ -54,6 +54,8 @@  CLEANFUNCS += "deb_clean_source"
 # runs sstate_cleanall() taking that lock itself, and flock() would deadlock on
 # the nested acquisition.
 deb_clean_source() {
+    # isar-apt may not exist (yet), e.g. after removing the tmp directory
+    [ -f "${REPO_ISAR_DIR}/${DISTRO}/conf/distributions" ] || return 0
     repo_del_srcpackage "${REPO_ISAR_DIR}"/"${DISTRO}" \
         "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${DEBIAN_SOURCE}"
 }