diff mbox series

[v3,1/6] wic: add runtime dependencies on the tools it invokes

Message ID 20260717133421.3510970-2-twoerner@gmail.com
State New
Headers show
Series wic: ship its tools, and add an SDK_FEATURES lever | expand

Commit Message

Trevor Woerner July 17, 2026, 1:34 p.m. UTC
wic shells out to a number of host-side tools to do its work: parted,
mkdosfs, mcopy, the mkfs.* family, sfdisk, e2fsck, resize2fs, debugfs,
blkid and more, depending on the operation and on the partition types
in the image.

None of these are declared as dependencies of wic. For the bitbake
do_image_wic task this is handled by the wic-tools recipe, which builds
the tools into a native sysroot. Wherever else wic is installed as a
package it gets none of them, and its offline lookup (wic ls/cp/write)
resolves each tool over a search path that falls back to the host PATH,
so on a machine that happens to have the tool installed system-wide wic
succeeds while on a machine without it wic fails:

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

Falling back to the host is unreliable even when the tool is found: wic
depends on specific minimum versions of some of these tools, and an
arbitrary host copy may be too old, so wic can pick up a tool that does
not behave as it needs. Declaring the tools as dependencies pins
known-good versions instead of trusting whatever the host provides.

Add the tools wic runs as RDEPENDS so they are installed alongside it.
resize2fs is listed on its own because e2fsprogs packages it separately
as e2fsprogs-resize2fs, which e2fsprogs does not pull in, and wic needs
it for the cp/write resize path.

syslinux (with its isohybrid helper) is only available on x86, so it is
gated to those hosts; cdrtools (mkisofs) is native-only with no
nativesdk variant and is only needed for ISO images, so it is not
listed here.

AI-Generated: codex/claude-opus 4.8 (xhigh)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v3:
- list the tools on all variants rather than only the nativesdk variant

changes in v2:
- merge the tool list from the v1 "wic-tools.inc: add" patch into this recipe as RDEPENDS; the separate .inc is dropped
- list the tools inline rather than via a shared WIC_TOOLS variable
- note in the commit log that a host tool may also be the wrong version, not merely absent
---
 meta/recipes-support/wic/wic_0.3.1.bb | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-support/wic/wic_0.3.1.bb b/meta/recipes-support/wic/wic_0.3.1.bb
index d9b4cc05c4bd..0911a2ae35d7 100644
--- a/meta/recipes-support/wic/wic_0.3.1.bb
+++ b/meta/recipes-support/wic/wic_0.3.1.bb
@@ -17,4 +17,27 @@  RDEPENDS:${PN} += " \
     python3-misc \
     "
 
+# wic shells out to these host-side tools when it runs, so they must be
+# installed alongside it.
+RDEPENDS:${PN} += " \
+    parted \
+    gptfdisk \
+    dosfstools \
+    mtools \
+    bmaptool \
+    grub \
+    btrfs-tools \
+    squashfs-tools \
+    e2fsprogs \
+    e2fsprogs-resize2fs \
+    util-linux \
+    tar \
+    erofs-utils \
+"
+
+# syslinux (with its isohybrid helper) is only available on x86.
+RDEPENDS:${PN}:append:x86 = " syslinux syslinux-misc"
+RDEPENDS:${PN}:append:x86-64 = " syslinux syslinux-misc"
+RDEPENDS:${PN}:append:x86-x32 = " syslinux syslinux-misc"
+
 BBCLASSEXTEND = "native nativesdk"