[1/1] meta: derive ROOTFS_DISTRO correctly in sbom-chroot's do_prepare_rootfs

Message ID 20250911130408.3836054-2-srinuvasan.a@siemens.com
State New
Headers show
Series Add SBOM generation with debsbom | expand

Commit Message

srinuvasan.a Sept. 11, 2025, 1:04 p.m. UTC
From: srinuvasan <srinuvasan.a@siemens.com>

In downstream layers, the ROOTFS_DISTRO may differ from "debian".
During `rootfs_prepare` of `sbom-chroot`, this causes failures such as:

  | DEBUG: Executing shell function rootfs_prepare
  | tar: .../debian-bookworm-amd64.tar.zst: Cannot open: No such file or directory
  | tar: Error is not recoverable: exiting now
  | WARNING: exit code 2 from a shell command.

The actual bootstrap archive generated was:
  industrial-bookworm-amd64.tar.zst

Fix this by deriving ROOTFS_DISTRO from the current DISTRO, ensuring the
bootstrap tarball is unpacked and configured correctly.

As part of this change, remove `ROOTFS_DISTRO`, `ROOTFS_ARCH`, and
`ROOTFS_BASE_DISTRO` from the `sbom-chroot` recipe.

This modification brings it in line with the sbuild-chroot-target recipe.

Note: The sbom class is already inherited via rootfs, so it can be removed from the sbom-chroot recipe.

Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
---
 meta/recipes-devtools/sbom-chroot/sbom-chroot.bb | 5 -----
 1 file changed, 5 deletions(-)

Comments

MOESSBAUER, Felix Sept. 11, 2025, 1:53 p.m. UTC | #1
On Thu, 2025-09-11 at 18:34 +0530, srinuvasan.a@siemens.com wrote:
> From: srinuvasan <srinuvasan.a@siemens.com>
> 
> In downstream layers, the ROOTFS_DISTRO may differ from "debian".
> During `rootfs_prepare` of `sbom-chroot`, this causes failures such as:
> 
>   | DEBUG: Executing shell function rootfs_prepare
>   | tar: .../debian-bookworm-amd64.tar.zst: Cannot open: No such file or directory
>   | tar: Error is not recoverable: exiting now
>   | WARNING: exit code 2 from a shell command.
> 
> The actual bootstrap archive generated was:
>   industrial-bookworm-amd64.tar.zst
> 
> Fix this by deriving ROOTFS_DISTRO from the current DISTRO, ensuring the
> bootstrap tarball is unpacked and configured correctly.
> 
> As part of this change, remove `ROOTFS_DISTRO`, `ROOTFS_ARCH`, and
> `ROOTFS_BASE_DISTRO` from the `sbom-chroot` recipe.
> 
> This modification brings it in line with the sbuild-chroot-target recipe.
> 
> Note: The sbom class is already inherited via rootfs, so it can be removed from the sbom-chroot recipe.
> 
> Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
> ---
>  meta/recipes-devtools/sbom-chroot/sbom-chroot.bb | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb b/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
> index 6f27f842..7f5ebc5b 100644
> --- a/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
> +++ b/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
> @@ -8,11 +8,6 @@ LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
>  PV = "1.0"
>  
>  inherit rootfs
> -inherit sbom

This patch is based on the SBOM patchset which is not merged yet.
Please directly provide your feedback on the SBOM patchset to fix it
there.

Best regards,
Felix

> -
> -ROOTFS_ARCH = "${HOST_ARCH}"
> -ROOTFS_DISTRO = "${HOST_DISTRO}"
> -ROOTFS_BASE_DISTRO = "${HOST_BASE_DISTRO}"
>  
>  ROOTFS_FEATURES = "no-generate-initrd"
>  
> -- 
> 2.39.5

Patch

diff --git a/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb b/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
index 6f27f842..7f5ebc5b 100644
--- a/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
+++ b/meta/recipes-devtools/sbom-chroot/sbom-chroot.bb
@@ -8,11 +8,6 @@  LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260
 PV = "1.0"
 
 inherit rootfs
-inherit sbom
-
-ROOTFS_ARCH = "${HOST_ARCH}"
-ROOTFS_DISTRO = "${HOST_DISTRO}"
-ROOTFS_BASE_DISTRO = "${HOST_BASE_DISTRO}"
 
 ROOTFS_FEATURES = "no-generate-initrd"