[1/1] rootfs: remove temporary sstate deploy directory after task execution

Message ID 20260223133255.1025809-1-felix.moessbauer@siemens.com
State New
Headers show
Series [1/1] rootfs: remove temporary sstate deploy directory after task execution | expand

Commit Message

MOESSBAUER, Felix Feb. 23, 2026, 1:32 p.m. UTC
The rootfs_install_sstate_prepare currently leaves an empty directory
skeleton behind. As this does not have any value for debugging, we
remove it.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes-recipe/rootfs.bbclass | 2 ++
 1 file changed, 2 insertions(+)

Comments

MOESSBAUER, Felix Feb. 23, 2026, 1:43 p.m. UTC | #1
On Mon, 2026-02-23 at 14:32 +0100, Felix Moessbauer wrote:
> The rootfs_install_sstate_prepare currently leaves an empty directory
> skeleton behind. As this does not have any value for debugging, we
> remove it.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/classes-recipe/rootfs.bbclass | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
> index 73ffa6b2..9044bf93 100644
> --- a/meta/classes-recipe/rootfs.bbclass
> +++ b/meta/classes-recipe/rootfs.bbclass
> @@ -662,6 +662,8 @@ rootfs_install_sstate_prepare() {
>      # tar --one-file-system will cross bind-mounts to the same filesystem,
>      # so we use some mount magic to prevent that
>      mkdir -p ${WORKDIR}/mnt/rootfs
> +    trap 'rmdir ${WORKDIR}/mnt/rootfs ${WORKDIR}/mnt' EXIT
> +

PS: I found this while working on the rootless series. I just noticed,
that this patch does not apply as-is on isar next, but the idea behind
it should be clear.

Felix

>      run_privileged_heredoc <<'EOF' 3> rootfs.tar
>          mount -o bind,private '${ROOTFSDIR}' '${WORKDIR}/mnt/rootfs' -o ro
>          lopts="--one-file-system --exclude=var/cache/apt/archives"
> -- 
> 2.51.0

Patch

diff --git a/meta/classes-recipe/rootfs.bbclass b/meta/classes-recipe/rootfs.bbclass
index 73ffa6b2..9044bf93 100644
--- a/meta/classes-recipe/rootfs.bbclass
+++ b/meta/classes-recipe/rootfs.bbclass
@@ -662,6 +662,8 @@  rootfs_install_sstate_prepare() {
     # tar --one-file-system will cross bind-mounts to the same filesystem,
     # so we use some mount magic to prevent that
     mkdir -p ${WORKDIR}/mnt/rootfs
+    trap 'rmdir ${WORKDIR}/mnt/rootfs ${WORKDIR}/mnt' EXIT
+
     run_privileged_heredoc <<'EOF' 3> rootfs.tar
         mount -o bind,private '${ROOTFSDIR}' '${WORKDIR}/mnt/rootfs' -o ro
         lopts="--one-file-system --exclude=var/cache/apt/archives"