diff mbox series

[2/4] wic: add runtime dependencies on the tools it invokes

Message ID 20260701075411.1092848-3-twoerner@gmail.com
State New
Headers show
Series wic: ship the tools it needs where it is packaged | expand

Commit Message

Trevor Woerner July 1, 2026, 7:54 a.m. UTC
wic shells out to a number of host-side tools (parted, mkdosfs, mcopy,
the mkfs.* family, mdir, sfdisk, e2fsck, resize2fs, debugfs, blkid,
...) but does not declare them as dependencies. For the bitbake
do_image_wic task this is handled by the wic-tools recipe, which builds
those tools into the native sysroot. Wherever else wic is installed as
a package it gets none of them, and its offline lookup (wic ls/cp/write)
falls back to the host PATH, so wic works only by chance depending on
what the host has installed:

  wic.WicError: Can't find executable 'mcopy'

Make wic carry the tools it may invoke by adding the shared WIC_TOOLS
helpers as RDEPENDS. They are added to the nativesdk variant, which is
where wic is packaged for use outside a bitbake build; the native and
target variants are unaffected.

resize2fs is added explicitly: e2fsprogs splits it into its own
e2fsprogs-resize2fs package, so nativesdk-e2fsprogs alone does not
provide it, and it is needed by the wic cp/write resize path.

syslinux (with its isohybrid helper) is gated to x86 hosts; cdrtools
(mkisofs) is native-only with no nativesdk variant and is only needed
for ISO images, so it cannot be included.

AI-Generated: codex/claude-opus 4.8 (xhigh)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 meta/recipes-support/wic/wic_0.3.0.bb | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-support/wic/wic_0.3.0.bb b/meta/recipes-support/wic/wic_0.3.0.bb
index 7dbf84b039a6..6efe974e02bd 100644
--- a/meta/recipes-support/wic/wic_0.3.0.bb
+++ b/meta/recipes-support/wic/wic_0.3.0.bb
@@ -10,6 +10,8 @@  CVE_PRODUCT = "yoctoproject:wic"
 
 inherit python_hatchling
 
+require recipes-core/meta/wic-tools.inc
+
 RDEPENDS:${PN} += " \
     python3-core \
     python3-json \
@@ -17,4 +19,20 @@  RDEPENDS:${PN} += " \
     python3-misc \
     "
 
+# wic shells out to the WIC_TOOLS tools but does not declare them, so
+# wherever wic is installed as a package it may not have them and its
+# offline lookup falls back to the host PATH. Pull them in for the
+# nativesdk variant so they are present regardless of the host; native
+# and target wic are unaffected.
+RDEPENDS:${PN}:append:class-nativesdk = "${@' '.join(' nativesdk-%s' % t for t in d.getVar('WIC_TOOLS').split())}"
+
+# resize2fs is split into its own e2fsprogs-resize2fs package, so
+# nativesdk-e2fsprogs alone does not provide it.
+RDEPENDS:${PN}:append:class-nativesdk = " nativesdk-e2fsprogs-resize2fs"
+
+# syslinux (and its isohybrid helper, in the -misc package) only builds
+# for x86 hosts; cdrtools (mkisofs) is native-only with no nativesdk
+# variant and so cannot be included.
+RDEPENDS:${PN}:append:class-nativesdk = "${@' nativesdk-syslinux nativesdk-syslinux-misc' if d.getVar('SDK_ARCH') in ['x86_64', 'i686'] else ''}"
+
 BBCLASSEXTEND = "native nativesdk"