standalone wic
v6 cover standalone wic
This series of patches splits wic out from oe-core into its own standalone utility. The wic utility will continue to be under The Yocto Project umbrella, but will no longer be integrated into the project as part of oe-core. The ultimate goal is to make wic a completely independent tool, hosted on PyPI, with its own tests, development roadmap, and releases.
Some benefits include:
- relieving the oe-core maintainers from having to review wic patches
- allow the tool to be used outside of The Yocto Project
- provide more flexibility to explore other features, libraries, mechanisms, etc
These changes have been tested with oe-selftest as follows:
$ sudo .../layers/openembedded-core/scripts/runqemu-gen-tapdevs <my numeric group id> 4
$ oe-selftest -v -r wic Previously, I had two separate patch sets for wic on oe-core: one to create a standalone utility, and one to re-implement variable sector-size handling. Both these were combined to create a combined "v5" patch set.
In v6 the major changes are:
- code cleanups to remove cases of "if sector_size and sector_size = 512" in places where we can guarantee sector_size will exist
- cleanups to replace "getattr(var, 'sector_size', 512) or 512" since the 3rd arg to getattr() is already setting a default if the variable name is not found
- many comment and commit comment improvements
- error out if extraopts includes options to set the sector-size in wks files
- patch 2 (add ufs class) was dropped
- patches 3 and 4 were reversed (move/save wks files before removing the rest of wic from oe-core)
For the patch sets up to and including v5:
For the standalone patch set:
v1: an RFC patchset was sent out, split up into small patches for easy
review
v2: add wic utility to list of native dependencies of
image_types_wic.bbclass
v3: squash all commits together to apply atomically
v4: (does not exist)
v5: rebase on latest master
split commits back out acknowledging any bisection that lands between them will fail
combine with sector-size patch
For the sector-size patch:
v1: initial patch set
v2: add Mark as co-author of ufs class
try to fix a build warning when not using wic
v3: actually fix warning when not using wic
v4: deprecate, but allow, WIC_SECTOR_SIZE to continue to be used to set
the sector-size both from config files and the environment warn when both are used, but prefer cmdline value
change partition type of sample wks to gpt
v5: fix a bug where WIC_SECTOR_SIZE is not given anywhere
combine with standalone patch set
Trevor Woerner (9):
wic: re-implement sector-size support
wic: move sample *wks files
wic: move to standalone repository
wic: add recipe
oe-selftest/cases/wic.py: update WicTestCase oe-selftest/cases/wic.py: oe-selftest -r wic.CLITests -> PASS oe-selftest/cases/wic.py: oe-selftest -r wic.ModifyTests -> PASS oe-selftest/cases/wic.py: oe-selftest -r wic.Wic -> PASS oe-selftest/cases/wic.py: oe-selftest -r wic.Wic2 -> PASS
meta/classes-recipe/image_types_wic.bbclass | 6 +-
meta/conf/distro/include/maintainers.inc | 3 +-
meta/lib/oeqa/selftest/cases/wic.py | 294 ++--
meta/recipes-core/meta/wic-tools.bb | 1 +
meta/recipes-support/wic/wic_0.3.0.bb | 18 +
.../canned-wks => meta/wic}/common.wks.inc | 0
.../wic}/directdisk-bootloader-config.cfg | 0
.../wic}/directdisk-bootloader-config.wks | 0
.../wic}/directdisk-gpt.wks | 0
.../wic}/directdisk-multi-rootfs.wks | 0
.../canned-wks => meta/wic}/directdisk.wks | 0
.../wic}/efi-bootdisk.wks.in | 0
.../wic}/efi-uki-bootdisk.wks.in | 0
.../wic/canned-wks => meta/wic}/mkefidisk.wks | 0
.../canned-wks => meta/wic}/mkhybridiso.wks | 0
.../canned-wks => meta/wic}/qemuloongarch.wks | 0
.../wic/canned-wks => meta/wic}/qemuriscv.wks | 0
.../wic}/qemux86-directdisk.wks | 0
.../wic}/sdimage-bootpart.wks | 0
.../wic}/systemd-bootdisk.wks | 0
scripts/lib/wic/__init__.py | 10 -
scripts/lib/wic/engine.py | 710 ----------
scripts/lib/wic/filemap.py | 583 --------
scripts/lib/wic/help.py | 1188 -----------------
scripts/lib/wic/ksparser.py | 322 -----
scripts/lib/wic/misc.py | 266 ----
scripts/lib/wic/partition.py | 562 --------
scripts/lib/wic/pluginbase.py | 144 --
scripts/lib/wic/plugins/imager/direct.py | 710 ----------
.../wic/plugins/source/bootimg_biosplusefi.py | 213 ---
scripts/lib/wic/plugins/source/bootimg_efi.py | 435 ------
.../wic/plugins/source/bootimg_partition.py | 162 ---
.../lib/wic/plugins/source/bootimg_pcbios.py | 483 -------
scripts/lib/wic/plugins/source/empty.py | 89 --
.../lib/wic/plugins/source/extra_partition.py | 146 --
.../wic/plugins/source/isoimage_isohybrid.py | 463 -------
scripts/lib/wic/plugins/source/rawcopy.py | 115 --
scripts/lib/wic/plugins/source/rootfs.py | 236 ----
scripts/wic | 600 ---------
39 files changed, 165 insertions(+), 7594 deletions(-)
create mode 100644 meta/recipes-support/wic/wic_0.3.0.bb
rename {scripts/lib/wic/canned-wks => meta/wic}/common.wks.inc (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk-bootloader-config.cfg (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk-bootloader-config.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk-gpt.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk-multi-rootfs.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/efi-bootdisk.wks.in (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/efi-uki-bootdisk.wks.in (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/mkefidisk.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/mkhybridiso.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/qemuloongarch.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/qemuriscv.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/qemux86-directdisk.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/sdimage-bootpart.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/systemd-bootdisk.wks (100%)
delete mode 100644 scripts/lib/wic/__init__.py
delete mode 100644 scripts/lib/wic/engine.py
delete mode 100644 scripts/lib/wic/filemap.py
delete mode 100644 scripts/lib/wic/help.py
delete mode 100644 scripts/lib/wic/ksparser.py
delete mode 100644 scripts/lib/wic/misc.py
delete mode 100644 scripts/lib/wic/partition.py
delete mode 100644 scripts/lib/wic/pluginbase.py
delete mode 100644 scripts/lib/wic/plugins/imager/direct.py
delete mode 100644 scripts/lib/wic/plugins/source/bootimg_biosplusefi.py
delete mode 100644 scripts/lib/wic/plugins/source/bootimg_efi.py
delete mode 100644 scripts/lib/wic/plugins/source/bootimg_partition.py
delete mode 100644 scripts/lib/wic/plugins/source/bootimg_pcbios.py
delete mode 100644 scripts/lib/wic/plugins/source/empty.py
delete mode 100644 scripts/lib/wic/plugins/source/extra_partition.py
delete mode 100644 scripts/lib/wic/plugins/source/isoimage_isohybrid.py
delete mode 100644 scripts/lib/wic/plugins/source/rawcopy.py
delete mode 100644 scripts/lib/wic/plugins/source/rootfs.py
delete mode 100755 scripts/wicSignature · 1 line
2.51.0
PATCH v6 1/9 wic: re-implement sector-size support
The previous implementation to add variable sector-size support:
- required the variable WIC_SECTOR_SIZE either be defined in a configuration file or be defined in a --vars file
- this means that every invocation of "wic ls", "wic cp", or "wic rm" needed this variable defined (config or --vars)
- required the user to create separate *wks files for every sector size they wanted to use
- required the user to specify the mkfs-extraopts by hand to specify the correct sector size: e.g.
bootloader --ptable gpt part --fstype ext4 --source rootfs --label rofs-a --mkfs-extraopts "-b 4096" part --fstype ext4 --source rootfs --use-uuid --mkfs-extraopts "-b 4096"
- specifying --mkfs-extraopts replaces the defaults with the user-supplied values
- only provided details to support using variable sector-sizes with ext[234] filesystems
- it would not be possible to generate images with different sector sizes in the same build since the configuration and *wks files would need to change and the build re-run for each size
Update the sector-size handling so that:
- the sector-size will now be provided on the cmdline to the "wic ls", "wic cp", "wic rm", and "wic create" commands: default = 512
- this means the configuration and/or --vars file does not need to be changed in order to perform those operations on images with different sector sizes
- support is provided implicitly for mkdosfs and ext[234] partitions
- the user no longer needs to know and supply the sector-size magic in --mkfs-extraopts (thereby clobbering the other defaults), in fact if they do wic will throw an error since those values may conflict with the sector-size value given on the cmdline
If the --sector-size command-line argument is not given, allow the sector-size to be provided via the WIC_SECTOR_SIZE bitbake variable. Warn the user whenever the WIC_SECTOR_SIZE bitbake variable is used, mention it is deprecated, and suggest the user use the cmdline arg instead. If both are given, warn the user that the cmdline argument takes precedence.
AI-Generated: codex/gpt-5.1-codex-max
---
changes in v6:
- many comments were expanded to provide deeper explanations
- in many places we know that sector_size will be defined (for example by virtue of it being an argument with a default value) therefore checks to make sure sector_size exists can be removed
- when processing extraopts for fat and ext* filesystems, error out if the user provides sector-size options in the wks file since these will conflict with sector-size settings on the cmdline or via WIC_SECTOR_SIZE
- clean up the logic related to warning the user if WIC_SECTOR_SIZE is used
changes in v5:
- fix a bug in the case where WIC_SECTOR_SIZE does not exist at all and is not provided neither in the environment nor a config file
changes in v4:
- allow the sector-size to be set from WIC_SECTOR_SIZE (environment or vars file) but mark its use deprecated, suggest the user use the cmdline arg instead; if both are given point out that the cmdline value takes precedence
changes in v3:
- none
changes in v2:
- none
--- meta/lib/oeqa/selftest/cases/wic.py | 39 +++-------- scripts/lib/wic/engine.py | 60 ++++++++++------- scripts/lib/wic/help.py | 23 +++++-- scripts/lib/wic/misc.py | 6 ++ scripts/lib/wic/partition.py | 67 +++++++++++++++++-- scripts/lib/wic/plugins/imager/direct.py | 18 ++--- scripts/lib/wic/plugins/source/bootimg_efi.py | 5 +- .../lib/wic/plugins/source/bootimg_pcbios.py | 11 +-- .../wic/plugins/source/isoimage_isohybrid.py | 5 +- scripts/wic | 42 ++++++++++++ 10 files changed, 188 insertions(+), 88 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +11 -28
@@ -935,33 +935,22 @@ bootloader --ptable gpt""") finally: os.remove(wks_file) - def test_wic_sector_size(self): - """Test generation image sector size""" - + def test_wic_sector_size_cli(self): + """Test sector size handling via CLI option.""" + oldpath = os.environ['PATH'] os.environ['PATH'] = get_bb_var("PATH", "wic-tools") try: - # Add WIC_SECTOR_SIZE into config - config = 'WIC_SECTOR_SIZE = "4096"\n'\ - 'WICVARS:append = " WIC_SECTOR_SIZE"\n' - self.append_config(config) bitbake('core-image-minimal') - # Check WIC_SECTOR_SIZE apply to bitbake variable - wic_sector_size_str = get_bb_var('WIC_SECTOR_SIZE', 'core-image-minimal') - wic_sector_size = int(wic_sector_size_str) - self.assertEqual(4096, wic_sector_size) - - self.logger.info("Test wic_sector_size: %d \n" % wic_sector_size) - with NamedTemporaryFile("w", suffix=".wks") as wks: wks.writelines( ['bootloader --ptable gpt\n', - 'part --fstype ext4 --source rootfs --label rofs-a --mkfs-extraopts "-b 4096"\n', - 'part --fstype ext4 --source rootfs --use-uuid --mkfs-extraopts "-b 4096"\n']) + 'part --fstype ext4 --source rootfs --label rofs-a\n', + 'part --fstype ext4 --source rootfs --use-uuid\n']) wks.flush() - cmd = "wic create %s -e core-image-minimal -o %s" % (wks.name, self.resultdir) + cmd = "wic create %s -e core-image-minimal -o %s --sector-size 4096" % (wks.name, self.resultdir) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] images = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -969,24 +958,18 @@ bootloader --ptable gpt""") sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') # list partitions - result = runCmd("wic ls %s -n %s" % (images[0], sysroot)) + result = runCmd("wic ls %s -n %s --sector-size 4096" % (images[0], sysroot)) self.assertEqual(3, len(result.output.split('\n'))) - # verify partition size with wic - res = runCmd("export PARTED_SECTOR_SIZE=%d; parted -m %s unit b p" % (wic_sector_size, images[0]), + # verify partition size with parted output + res = runCmd("export PARTED_SECTOR_SIZE=%d; parted -m %s unit b p" % (4096, images[0]), stderr=subprocess.PIPE) - # parse parted output which looks like this: - # BYT;\n - # /var/tmp/wic/build/tmpgjzzefdd-202410281021-sda.direct:78569472B:file:4096:4096:gpt::;\n - # 1:139264B:39284735B:39145472B:ext4:rofs-a:;\n - # 2:39284736B:78430207B:39145472B:ext4:primary:;\n disk_info = res.output.splitlines()[1] - # Check sector sizes sector_size_logical = int(disk_info.split(":")[3]) sector_size_physical = int(disk_info.split(":")[4]) - self.assertEqual(wic_sector_size, sector_size_logical, "Logical sector size is not %d." % wic_sector_size) - self.assertEqual(wic_sector_size, sector_size_physical, "Physical sector size is not %d." % wic_sector_size) + self.assertEqual(4096, sector_size_logical, "Logical sector size is not 4096.") + self.assertEqual(4096, sector_size_physical, "Physical sector size is not 4096.") finally: os.environ['PATH'] = oldpath
scripts/lib/wic/engine.py +34 -26
118 lines not on this page · raw message
scripts/lib/wic/help.py +16 -7
@@ -118,7 +118,7 @@ wic_create_usage = """ usage: wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>] [-e | --image-name] [-s, --skip-build-check] [-D, --debug] [-r, --rootfs-dir] [-b, --bootimg-dir] - [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs] + [-k, --kernel-dir] [-n, --native-sysroot] [--sector-size <bytes>] [-f, --build-rootfs] [-c, --compress-with] [-m, --bmap] This command creates an OpenEmbedded image based on the 'OE kickstart
@@ -139,13 +139,16 @@ SYNOPSIS wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>] [-e | --image-name] [-s, --skip-build-check] [-D, --debug] [-r, --rootfs-dir] [-b, --bootimg-dir] - [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs] + [-k, --kernel-dir] [-n, --native-sysroot] [--sector-size <bytes>] [-f, --build-rootfs] [-c, --compress-with] [-m, --bmap] [--no-fstab-update] DESCRIPTION This command creates an OpenEmbedded image based on the 'OE kickstart commands' found in the <wks file>. + Use the --sector-size option to select the sector size (in bytes) + used for partition layout calculations (default is 512). + In order to do this, wic needs to know the locations of the various build artifacts required to build the image.
@@ -278,7 +281,7 @@ wic_ls_usage = """ List content of a partitioned image - usage: wic ls <image>[:<partition>[<path>]] [--native-sysroot <path>] + usage: wic ls <image>[:<partition>[<path>]] [--native-sysroot <path>] [--sector-size <bytes>] This command outputs either list of image partitions or directory contents of vfat and ext* partitions.
@@ -296,7 +299,7 @@ SYNOPSIS wic ls <image> wic ls <image>:<vfat or ext* partition> wic ls <image>:<vfat or ext* partition><path> - wic ls <image>:<vfat or ext* partition><path> --native-sysroot <path> + wic ls <image>:<vfat or ext* partition><path> --native-sysroot <path> [--sector-size <bytes>] DESCRIPTION This command lists either partitions of the image or directory contents
@@ -336,6 +339,8 @@ DESCRIPTION The -n option is used to specify the path to the native sysroot containing the tools(parted and mtools) to use. + The --sector-size option sets the sector size used for partition math + (default is 512 bytes). """
@@ -343,7 +348,7 @@ wic_cp_usage = """ Copy files and directories to/from the vfat or ext* partition - usage: wic cp <src> <dest> [--native-sysroot <path>] + usage: wic cp <src> <dest> [--native-sysroot <path>] [--sector-size <bytes>] source/destination image in format <image>:<partition>[<path>]
@@ -364,7 +369,7 @@ SYNOPSIS wic cp <src> <dest>:<partition> wic cp <src>:<partition> <dest> wic cp <src> <dest-image>:<partition><path> - wic cp <src> <dest-image>:<partition><path> --native-sysroot <path> + wic cp <src> <dest-image>:<partition><path> --native-sysroot <path> [--sector-size <bytes>] DESCRIPTION This command copies files or directories either
@@ -408,13 +413,15 @@ DESCRIPTION The -n option is used to specify the path to the native sysroot containing the tools(parted and mtools) to use. + The --sector-size option sets the sector size used for partition math + (default is 512 bytes). """ wic_rm_usage = """ Remove files or directories from the vfat or ext* partitions - usage: wic rm <image>:<partition><path> [--native-sysroot <path>] + usage: wic rm <image>:<partition><path> [--native-sysroot <path>] [--sector-size <bytes>] This command removes files or directories from the vfat or ext* partitions of the partitioned image.
@@ -466,6 +473,8 @@ DESCRIPTION The -n option is used to specify the path to the native sysroot containing the tools(parted and mtools) to use. + The --sector-size option sets the sector size used for partition math + (default is 512 bytes). The -r option is used to remove directories and their contents recursively,this only applies to ext* partition.
scripts/lib/wic/misc.py +6 -0
@@ -263,4 +263,10 @@ def get_bitbake_var(var, image=None, cache=True): Provide old get_bitbake_var API by wrapping get_var method of BB_VARS singleton. """ + if var == "WIC_SECTOR_SIZE": + env_val = os.environ.get("WIC_SECTOR_SIZE") + if env_val is not None: + logger.warning("DEPRECATED: Using WIC_SECTOR_SIZE from environment; prefer --sector-size to avoid surprises.") + return env_val + return BB_VARS.get_var(var, image, cache)
scripts/lib/wic/partition.py +62 -5
106 lines not on this page · raw message
scripts/lib/wic/plugins/imager/direct.py +5 -13
@@ -67,6 +67,7 @@ class DirectPlugin(ImagerPlugin): self._image = None self.ptable_format = self.ks.bootloader.ptable self.parts = self.ks.partitions + self.sector_size = options.sector_size or 512 # as a convenience, set source to the boot partition source # instead of forcing it to be set via bootloader --source
@@ -78,7 +79,7 @@ class DirectPlugin(ImagerPlugin): image_path = self._full_path(self.workdir, self.parts[0].disk, "direct") self._image = PartitionedImage(image_path, self.ptable_format, self.ks.bootloader.diskid, self.parts, self.native_sysroot, - options.extra_space) + options.extra_space, self.sector_size) def setup_workdir(self, workdir): if workdir:
@@ -294,15 +295,13 @@ MBR_OVERHEAD = 1 # Overhead of the GPT partitioning scheme GPT_OVERHEAD = 34 -# Size of a sector in bytes -SECTOR_SIZE = 512 - class PartitionedImage(): """ Partitioned image in a file. """ - def __init__(self, path, ptable_format, disk_id, partitions, native_sysroot=None, extra_space=0): + def __init__(self, path, ptable_format, disk_id, partitions, native_sysroot=None, extra_space=0, + sector_size=512): self.path = path # Path to the image file self.numpart = 0 # Number of allocated partitions self.realpart = 0 # Number of partitions in the partition table
@@ -332,14 +331,7 @@ class PartitionedImage(): self.partitions = partitions self.partimages = [] # Size of a sector used in calculations - sector_size_str = get_bitbake_var('WIC_SECTOR_SIZE') - if sector_size_str is not None: - try: - self.sector_size = int(sector_size_str) - except ValueError: - self.sector_size = SECTOR_SIZE - else: - self.sector_size = SECTOR_SIZE + self.sector_size = sector_size self.native_sysroot = native_sysroot num_real_partitions = len([p for p in self.partitions if not p.no_table])
scripts/lib/wic/plugins/source/bootimg_efi.py +3 -2
@@ -415,8 +415,9 @@ class BootimgEFIPlugin(SourcePlugin): label = part.label if part.label else "ESP" - dosfs_cmd = "mkdosfs -v -n %s -i %s -C %s %d" % \ - (label, part.fsuuid, bootimg, blocks) + sector_size = getattr(creator, 'sector_size', 512) + dosfs_cmd = "mkdosfs -v -n %s -i %s -S %d -C %s %d" % \ + (label, part.fsuuid, sector_size, bootimg, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) logger.debug("mkdosfs:\n%s" % (str(out)))
scripts/lib/wic/plugins/source/bootimg_pcbios.py +6 -5
@@ -132,7 +132,7 @@ class BootimgPcbiosPlugin(SourcePlugin): cls._do_prepare_grub(part, cr_workdir, oe_builddir, kernel_dir, rootfs_dir, native_sysroot) elif source_params['loader-bios'] == 'syslinux': - cls._do_prepare_syslinux(part, cr_workdir, bootimg_dir, + cls._do_prepare_syslinux(part, creator, cr_workdir, bootimg_dir, kernel_dir, native_sysroot) else: raise WicError("unrecognized bootimg_pcbios loader: %s" % source_params['loader-bios'])
@@ -142,7 +142,7 @@ class BootimgPcbiosPlugin(SourcePlugin): except KeyError: # Required by do_install_disk cls.loader = 'syslinux' - cls._do_prepare_syslinux(part, cr_workdir, bootimg_dir, + cls._do_prepare_syslinux(part, creator, cr_workdir, bootimg_dir, kernel_dir, native_sysroot) @classmethod
@@ -240,7 +240,7 @@ class BootimgPcbiosPlugin(SourcePlugin): cfg.close() @classmethod - def _do_prepare_syslinux(cls, part, cr_workdir, bootimg_dir, + def _do_prepare_syslinux(cls, part, creator, cr_workdir, bootimg_dir, kernel_dir, native_sysroot): """ Called to do the actual content population for a partition i.e. it
@@ -292,8 +292,9 @@ class BootimgPcbiosPlugin(SourcePlugin): label = part.label if part.label else "boot" - dosfs_cmd = "mkdosfs -n %s -i %s -S 512 -C %s %d" % \ - (label, part.fsuuid, bootimg, blocks) + sector_size = getattr(creator, 'sector_size', 512) + dosfs_cmd = "mkdosfs -n %s -i %s -S %d -C %s %d" % \ + (label, part.fsuuid, sector_size, bootimg, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)
scripts/lib/wic/plugins/source/isoimage_isohybrid.py +3 -2
@@ -367,8 +367,9 @@ class IsoImagePlugin(SourcePlugin): esp_label = source_params.get('esp_label', 'EFIimg') - dosfs_cmd = 'mkfs.vfat -n \'%s\' -S 512 -C %s %d' \ - % (esp_label, bootimg, blocks) + sector_size = getattr(creator, 'sector_size', 512) + dosfs_cmd = "mkfs.vfat -n '%s' -S %d -C %s %d" % \ + (esp_label, sector_size, bootimg, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) mmd_cmd = "mmd -i %s ::/EFI" % bootimg
scripts/wic +42 -0
78 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v6 2/9 wic: move sample *wks files
In reply to Trevor WoernerBy convention, wic will look for a "wic" directory in the top-level of all BBLAYERS in order to find *wks files. oe-core was the only exception; it stored its *wks files in scripts/lib/wic/canned-wks. Take the *wks, *wks.in, *inc, and *cfg files that were in the canned-wks location and place them in a "wic" top-level directory in the oe-core layer, thereby following the convention of every other layer.
---
changes in v6:
- re-ordered so that this patch occurs before wic is removed, thus saving the commit history
changes in v5:
- rebase with master
- split patchset out again
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large patch
changes in v2:
- none
---
meta/classes-recipe/image_types_wic.bbclass | 2 +-
{scripts/lib/wic/canned-wks => meta/wic}/common.wks.inc | 0
.../canned-wks => meta/wic}/directdisk-bootloader-config.cfg | 0
.../canned-wks => meta/wic}/directdisk-bootloader-config.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/directdisk-gpt.wks | 0
.../lib/wic/canned-wks => meta/wic}/directdisk-multi-rootfs.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/directdisk.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/efi-bootdisk.wks.in | 0
.../lib/wic/canned-wks => meta/wic}/efi-uki-bootdisk.wks.in | 0
{scripts/lib/wic/canned-wks => meta/wic}/mkefidisk.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/mkhybridiso.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/qemuloongarch.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/qemuriscv.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/qemux86-directdisk.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/sdimage-bootpart.wks | 0
{scripts/lib/wic/canned-wks => meta/wic}/systemd-bootdisk.wks | 0
16 files changed, 1 insertion(+), 1 deletion(-)
rename {scripts/lib/wic/canned-wks => meta/wic}/common.wks.inc (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk-bootloader-config.cfg (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk-bootloader-config.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk-gpt.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk-multi-rootfs.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/directdisk.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/efi-bootdisk.wks.in (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/efi-uki-bootdisk.wks.in (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/mkefidisk.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/mkhybridiso.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/qemuloongarch.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/qemuriscv.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/qemux86-directdisk.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/sdimage-bootpart.wks (100%)
rename {scripts/lib/wic/canned-wks => meta/wic}/systemd-bootdisk.wks (100%)meta/classes-recipe/image_types_wic.bbclass +1 -1
@@ -45,7 +45,7 @@ inherit_defer ${@bb.utils.contains('INITRAMFS_IMAGE_BUNDLE', '1', 'kernel-artifa WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks" WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks" -WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.join('%s/wic' % p for p in '${BBPATH}'.split(':'))}:${@':'.join('%s/scripts/lib/wic/canned-wks' % l for l in '${BBPATH}:${COREBASE}'.split(':'))}" +WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.join('%s/wic' % p for p in '${BBPATH}'.split(':'))}" WKS_FULL_PATH = "${@wks_search(d.getVar('WKS_FILES').split(), d.getVar('WKS_SEARCH_PATH')) or ''}" def wks_search(files, search_path):
meta/wic/common.wks.inc renamed from scripts/lib/wic/canned-wks/common.wks.inc +0 -0
meta/wic/directdisk-bootloader-config.cfg renamed from scripts/lib/wic/canned-wks/directdisk-bootloader-config.cfg +0 -0
meta/wic/directdisk-bootloader-config.wks renamed from scripts/lib/wic/canned-wks/directdisk-bootloader-config.wks +0 -0
meta/wic/directdisk-gpt.wks renamed from scripts/lib/wic/canned-wks/directdisk-gpt.wks +0 -0
meta/wic/directdisk-multi-rootfs.wks renamed from scripts/lib/wic/canned-wks/directdisk-multi-rootfs.wks +0 -0
meta/wic/directdisk.wks renamed from scripts/lib/wic/canned-wks/directdisk.wks +0 -0
meta/wic/efi-bootdisk.wks.in renamed from scripts/lib/wic/canned-wks/efi-bootdisk.wks.in +0 -0
meta/wic/efi-uki-bootdisk.wks.in renamed from scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in +0 -0
meta/wic/mkefidisk.wks renamed from scripts/lib/wic/canned-wks/mkefidisk.wks +0 -0
meta/wic/mkhybridiso.wks renamed from scripts/lib/wic/canned-wks/mkhybridiso.wks +0 -0
meta/wic/qemuloongarch.wks renamed from scripts/lib/wic/canned-wks/qemuloongarch.wks +0 -0
meta/wic/qemuriscv.wks renamed from scripts/lib/wic/canned-wks/qemuriscv.wks +0 -0
meta/wic/qemux86-directdisk.wks renamed from scripts/lib/wic/canned-wks/qemux86-directdisk.wks +0 -0
meta/wic/sdimage-bootpart.wks renamed from scripts/lib/wic/canned-wks/sdimage-bootpart.wks +0 -0
meta/wic/systemd-bootdisk.wks renamed from scripts/lib/wic/canned-wks/systemd-bootdisk.wks +0 -0
Signature · 1 line
2.51.0
PATCH v6 3/9 wic: move to standalone repository
In reply to Trevor WoernerThe wic utility will continue to exist under The Yocto Project umbrella, but will no longer be integrated into the project as part of oe-core. The ultimate goal is to make wic a completely independent tool, hosted on PyPI, with its own tests, development roadmap, and releases.
Some benefits include:
- relieving the oe-core maintainers from having to review wic patches
- allow the tool to be used outside of The Yocto Project
- provide more flexibility to explore other features, libraries, mechanisms, etc
The primary repository for standalone wic will be:
https://git.yoctoproject.org/wic
AI-Generated: codex/gpt-5.1-codex-max
---
changes in v6:
- improved commit summary
- swap this patch with what was patch 04/10 in v5 (this patch was 03/10 in v5)
changes in v5:
- rebase with master
- split patches out again
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large patch
changes in v2:
- none
--- scripts/lib/wic/__init__.py | 10 - scripts/lib/wic/engine.py | 718 ---------- scripts/lib/wic/filemap.py | 583 -------- scripts/lib/wic/help.py | 1197 ----------------- scripts/lib/wic/ksparser.py | 322 ----- scripts/lib/wic/misc.py | 272 ---- scripts/lib/wic/partition.py | 619 --------- scripts/lib/wic/pluginbase.py | 144 -- scripts/lib/wic/plugins/imager/direct.py | 702 ---------- .../wic/plugins/source/bootimg_biosplusefi.py | 213 --- scripts/lib/wic/plugins/source/bootimg_efi.py | 436 ------ .../wic/plugins/source/bootimg_partition.py | 162 --- .../lib/wic/plugins/source/bootimg_pcbios.py | 484 ------- scripts/lib/wic/plugins/source/empty.py | 89 -- .../lib/wic/plugins/source/extra_partition.py | 146 -- .../wic/plugins/source/isoimage_isohybrid.py | 464 ------- scripts/lib/wic/plugins/source/rawcopy.py | 115 -- scripts/lib/wic/plugins/source/rootfs.py | 236 ---- scripts/wic | 642 --------- 19 files changed, 7554 deletions(-) delete mode 100644 scripts/lib/wic/__init__.py delete mode 100644 scripts/lib/wic/engine.py delete mode 100644 scripts/lib/wic/filemap.py delete mode 100644 scripts/lib/wic/help.py delete mode 100644 scripts/lib/wic/ksparser.py delete mode 100644 scripts/lib/wic/misc.py delete mode 100644 scripts/lib/wic/partition.py delete mode 100644 scripts/lib/wic/pluginbase.py delete mode 100644 scripts/lib/wic/plugins/imager/direct.py delete mode 100644 scripts/lib/wic/plugins/source/bootimg_biosplusefi.py delete mode 100644 scripts/lib/wic/plugins/source/bootimg_efi.py delete mode 100644 scripts/lib/wic/plugins/source/bootimg_partition.py delete mode 100644 scripts/lib/wic/plugins/source/bootimg_pcbios.py delete mode 100644 scripts/lib/wic/plugins/source/empty.py delete mode 100644 scripts/lib/wic/plugins/source/extra_partition.py delete mode 100644 scripts/lib/wic/plugins/source/isoimage_isohybrid.py delete mode 100644 scripts/lib/wic/plugins/source/rawcopy.py delete mode 100644 scripts/lib/wic/plugins/source/rootfs.py delete mode 100755 scripts/wic
scripts/lib/wic/__init__.py deleted +0 -10
@@ -1,10 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2007 Red Hat, Inc. -# Copyright (c) 2011 Intel, Inc. -# -# SPDX-License-Identifier: GPL-2.0-only -# - -class WicError(Exception): - pass
scripts/lib/wic/engine.py deleted +0 -718
718 lines not on this page · raw message
scripts/lib/wic/filemap.py deleted +0 -583
583 lines not on this page · raw message
scripts/lib/wic/help.py deleted +0 -1197
1,197 lines not on this page · raw message
scripts/lib/wic/ksparser.py deleted +0 -322
322 lines not on this page · raw message
scripts/lib/wic/misc.py deleted +0 -272
170 lines not on this page · raw message
scripts/lib/wic/partition.py deleted +0 -619
619 lines not on this page · raw message
scripts/lib/wic/pluginbase.py deleted +0 -144
144 lines not on this page · raw message
scripts/lib/wic/plugins/imager/direct.py deleted +0 -702
702 lines not on this page · raw message
scripts/lib/wic/plugins/source/bootimg_biosplusefi.py deleted +0 -213
213 lines not on this page · raw message
scripts/lib/wic/plugins/source/bootimg_efi.py deleted +0 -436
436 lines not on this page · raw message
scripts/lib/wic/plugins/source/bootimg_partition.py deleted +0 -162
162 lines not on this page · raw message
scripts/lib/wic/plugins/source/bootimg_pcbios.py deleted +0 -484
484 lines not on this page · raw message
scripts/lib/wic/plugins/source/empty.py deleted +0 -89
89 lines not on this page · raw message
scripts/lib/wic/plugins/source/extra_partition.py deleted +0 -146
146 lines not on this page · raw message
scripts/lib/wic/plugins/source/isoimage_isohybrid.py deleted +0 -464
464 lines not on this page · raw message
scripts/lib/wic/plugins/source/rawcopy.py deleted +0 -115
115 lines not on this page · raw message
scripts/lib/wic/plugins/source/rootfs.py deleted +0 -236
236 lines not on this page · raw message
scripts/wic deleted +0 -642
642 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.51.0
Part of the diff is not shown here. View the raw message.
PATCH v6 4/9 wic: add recipe
In reply to Trevor WoernerAdd a recipe to pull in the newly-externalized wic utility. Add wic to the list of native wic-tools, and make it a dependency of the image bbclass for wic images.
---
changes in v6:
- the SRCREV was updated since any changes/revisions before the removal need to be reflected in the repository
changes in v5:
- rebase with master
- split patch set back out into smaller patches
- do not add TOPDIR and WIC_SECTOR_SIZE to image_types_wic.bbclass if a user wants them, they can add them to WICVARS in their config
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large patch
changes in v2:
- add wic as a native dependency of the image_types_wic.bbclass
--- meta/classes-recipe/image_types_wic.bbclass | 4 ++-- meta/conf/distro/include/maintainers.inc | 3 ++- meta/recipes-core/meta/wic-tools.bb | 1 + meta/recipes-support/wic/wic_0.3.0.bb | 18 ++++++++++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 meta/recipes-support/wic/wic_0.3.0.bb
meta/classes-recipe/image_types_wic.bbclass +2 -2
@@ -111,14 +111,14 @@ do_image_wic[cleandirs] = "${WORKDIR}/build-wic" USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}" WKS_FILE_CHECKSUM = "${@wks_checksums(d.getVar('WKS_FILES').split(), d.getVar('WKS_SEARCH_PATH')) if '${USING_WIC}' else ''}" do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}" -do_image_wic[depends] += "${@' '.join('%s-native:do_populate_sysroot' % r for r in ('parted', 'gptfdisk', 'dosfstools', 'mtools'))}" +do_image_wic[depends] += "${@' '.join('%s-native:do_populate_sysroot' % r for r in ('wic', 'parted', 'gptfdisk', 'dosfstools', 'mtools'))}" # We ensure all artfacts are deployed (e.g virtual/bootloader) do_image_wic[recrdeptask] += "do_deploy" do_image_wic[deptask] += "do_image_complete" WKS_FILE_DEPENDS_DEFAULT = '${@bb.utils.contains_any("BUILD_ARCH", [ 'x86_64', 'i686' ], "syslinux-native", "",d)}' -WKS_FILE_DEPENDS_DEFAULT += "bmaptool-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native" +WKS_FILE_DEPENDS_DEFAULT += "wic-native bmaptool-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native" # Unified kernel images need objcopy WKS_FILE_DEPENDS_DEFAULT += "virtual/cross-binutils" WKS_FILE_DEPENDS_BOOTLOADERS = ""
meta/conf/distro/include/maintainers.inc +2 -1
@@ -884,7 +884,8 @@ RECIPE_MAINTAINER:pn-weston = "Denys Dmytriyenko <[email protected]>" RECIPE_MAINTAINER:pn-weston-init = "Denys Dmytriyenko <[email protected]>" RECIPE_MAINTAINER:pn-wget = "Yi Zhao <[email protected]>" RECIPE_MAINTAINER:pn-which = "Unassigned <[email protected]>" -RECIPE_MAINTAINER:pn-wic-tools = "Unassigned <[email protected]>" +RECIPE_MAINTAINER:pn-wic = "Trevor Woerner <[email protected]>" +RECIPE_MAINTAINER:pn-wic-tools = "Trevor Woerner <[email protected]>" RECIPE_MAINTAINER:pn-wireless-regdb = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-wpa-supplicant = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-wpebackend-fdo = "Unassigned <[email protected]>"
meta/recipes-core/meta/wic-tools.bb +1 -0
@@ -3,6 +3,7 @@ SUMMARY = "A meta recipe to build native tools used by wic." LICENSE = "MIT" DEPENDS = "\ + wic-native \ parted-native gptfdisk-native dosfstools-native \ mtools-native bmaptool-native grub-native cdrtools-native \ btrfs-tools-native squashfs-tools-native pseudo-native \
meta/recipes-support/wic/wic_0.3.0.bb new file +18 -0
@@ -0,0 +1,18 @@ +SUMMARY = "OpenEmbedded Image Creator (wic) standalone CLI" +HOMEPAGE = "https://git.yoctoproject.org/wic" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM = "file://LICENSE;md5=4ee23c52855c222cba72583d301d2338" + +SRC_URI = "git://git.yoctoproject.org/wic.git;branch=master;protocol=https" +SRCREV = "eb1ea917c1790b3cb719e4526eec75531b727bcf" + +inherit python_hatchling + +RDEPENDS:${PN} += " \ + python3-core \ + python3-json \ + python3-logging \ + python3-misc \ + " + +BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.51.0
PATCH v6 5/9 oe-selftest/cases/wic.py: update WicTestCase
In reply to Trevor WoernerThe wic oe-selftest defines its own class, WicTestCase, for handling setup, teardown, and other pieces needed to run the individual wic oe-selftests. Now that wic is a tool external to oe-core, it, and the tools on which it depends, need to be built natively before the test can be run, need to be made available to the tests, and need to remain available while the test is running.
---
changes in v6:
- none
changes in v5:
- rebase with master
- split back out into smaller patches
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large patch
changes in v2:
- none
--- meta/lib/oeqa/selftest/cases/wic.py | 11 +++++++++++ 1 file changed, 11 insertions(+)
meta/lib/oeqa/selftest/cases/wic.py +11 -0
@@ -57,12 +57,22 @@ class WicTestCase(OESelftestTestCase): image_is_ready = False wicenv_cache = {} + oldpath = "" + envfile = "" def setUpLocal(self): """This code is executed before each test method.""" self.resultdir = os.path.join(self.builddir, "wic-tmp") super(WicTestCase, self).setUpLocal() + config = 'DEPENDS:pn-core-image-minimal += " %s"' % get_bb_var("DEPENDS", "wic-tools") + self.append_config(config) + bitbake('wic-tools core-image-minimal core-image-minimal-mtdutils') + WicTestCase.oldpath = os.environ['PATH'] + os.environ['PATH'] = get_bb_var("PATH", "wic-tools") + ":" + os.environ['PATH'] + image = 'core-image-minimal' + WicTestCase.envfile = os.path.join(self._get_image_env_path(image), image) + '.env' + # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable.
@@ -78,6 +88,7 @@ class WicTestCase(OESelftestTestCase): """Remove resultdir as it may contain images.""" rmtree(self.resultdir, ignore_errors=True) super(WicTestCase, self).tearDownLocal() + os.environ['PATH'] = WicTestCase.oldpath def _get_image_env_path(self, image): """Generate and obtain the path to <image>.env"""
Signature · 1 line
2.51.0
PATCH v6 6/9 oe-selftest/cases/wic.py: oe-selftest -r wic.CLITests -> PASS
In reply to Trevor WoernerChanges for the wic.CLITests oe-selftests to pass now that wic is a stand-alone app and no longer part of oe-core.
Note that the base class for these tests had to change to WicTestCase so that the wic-native tool would be built and available.
---
changes in v6:
- none
changes in v5:
- rebase with master
- split back out into smaller patches
- now that the sector-size re-implementation is ahead of this patch, various wic sub commands (ls, rm, cp) no longer need a --vars file
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large patch
changes in v2:
- none
--- meta/lib/oeqa/selftest/cases/wic.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +5 -5
@@ -99,7 +99,7 @@ class WicTestCase(OESelftestTestCase): WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata') return WicTestCase.wicenv_cache[image] -class CLITests(OESelftestTestCase): +class CLITests(WicTestCase): def test_version(self): """Test wic --version""" runCmd('wic --version')
@@ -139,18 +139,18 @@ class CLITests(OESelftestTestCase): def test_list_images(self): """Test wic list images""" - runCmd('wic list images') + runCmd('wic list images -v %s' % self.envfile) def test_list_source_plugins(self): """Test wic list source-plugins""" - runCmd('wic list source-plugins') + runCmd('wic list source-plugins -v %s' % self.envfile) def test_listed_images_help(self): """Test wic listed images help""" - output = runCmd('wic list images').output + output = runCmd('wic list images -v %s' % self.envfile).output imagelist = [line.split()[0] for line in output.splitlines()] for image in imagelist: - runCmd('wic list %s help' % image) + runCmd('wic list -v %s %s help' % (self.envfile, image)) def test_unsupported_subcommand(self): """Test unsupported subcommand"""
Signature · 1 line
2.51.0
PATCH v6 7/9 oe-selftest/cases/wic.py: oe-selftest -r wic.ModifyTests -> PASS
In reply to Trevor WoernerChanges for the wic.ModifyTests oe-selftests to pass now that wic is a stand-alone app and no longer part of oe-core.
---
changes in v6:
- none
changes in v5:
- rebase with master
- re-split out in to individual, smaller patches
- now that the sector-size re-implementation is ahead of this patch, various wic subcommands (ls, cp, rm) no longer need a --vars file
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large patch
changes in v2:
- none
--- meta/lib/oeqa/selftest/cases/wic.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +12 -12
@@ -1962,9 +1962,9 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" class ModifyTests(WicTestCase): def test_wic_ls(self): """Test listing image content using 'wic ls'""" - runCmd("wic create wictestdisk " + runCmd("wic create wictestdisk -v %s " "--image-name=core-image-minimal " - "-D -o %s" % self.resultdir) + "-D -o %s" % (self.envfile, self.resultdir)) images = glob(os.path.join(self.resultdir, "wictestdisk-*.direct")) self.assertEqual(1, len(images))
@@ -1980,9 +1980,9 @@ class ModifyTests(WicTestCase): def test_wic_cp(self): """Test copy files and directories to the the wic image.""" - runCmd("wic create wictestdisk " + runCmd("wic create wictestdisk -v %s " "--image-name=core-image-minimal " - "-D -o %s" % self.resultdir) + "-D -o %s" % (self.envfile, self.resultdir)) images = glob(os.path.join(self.resultdir, "wictestdisk-*.direct")) self.assertEqual(1, len(images))
@@ -2026,9 +2026,9 @@ class ModifyTests(WicTestCase): def test_wic_rm(self): """Test removing files and directories from the the wic image.""" - runCmd("wic create mkefidisk " + runCmd("wic create mkefidisk -v %s " "--image-name=core-image-minimal " - "-D -o %s" % self.resultdir) + "-D -o %s" % (self.envfile, self.resultdir)) images = glob(os.path.join(self.resultdir, "mkefidisk-*.direct")) self.assertEqual(1, len(images))
@@ -2054,9 +2054,9 @@ class ModifyTests(WicTestCase): def test_wic_ls_ext(self): """Test listing content of the ext partition using 'wic ls'""" - runCmd("wic create wictestdisk " + runCmd("wic create wictestdisk -v %s " "--image-name=core-image-minimal " - "-D -o %s" % self.resultdir) + "-D -o %s" % (self.envfile, self.resultdir)) images = glob(os.path.join(self.resultdir, "wictestdisk-*.direct")) self.assertEqual(1, len(images))
@@ -2069,9 +2069,9 @@ class ModifyTests(WicTestCase): def test_wic_cp_ext(self): """Test copy files and directories to the ext partition.""" - runCmd("wic create wictestdisk " + runCmd("wic create wictestdisk -v %s " "--image-name=core-image-minimal " - "-D -o %s" % self.resultdir) + "-D -o %s" % (self.envfile, self.resultdir)) images = glob(os.path.join(self.resultdir, "wictestdisk-*.direct")) self.assertEqual(1, len(images))
@@ -2169,9 +2169,9 @@ class ModifyTests(WicTestCase): def test_wic_rm_ext(self): """Test removing files from the ext partition.""" - runCmd("wic create mkefidisk " + runCmd("wic create mkefidisk -v %s " "--image-name=core-image-minimal " - "-D -o %s" % self.resultdir) + "-D -o %s" % (self.envfile, self.resultdir)) images = glob(os.path.join(self.resultdir, "mkefidisk-*.direct")) self.assertEqual(1, len(images))
Signature · 1 line
2.51.0
PATCH v6 8/9 oe-selftest/cases/wic.py: oe-selftest -r wic.Wic -> PASS
In reply to Trevor WoernerChanges for the wic.Wic oe-selftests to pass now that wic is a stand-alone app and no longer part of oe-core.
---
changes in v6:
- none
changes in v5:
- rebase with master
- split back out into multiple, smaller patches
- now that the sector-size re-implementation is ahead of this patch, several wic subcommands (ls, cp, rm) no longer need a --vars file
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large, atomic commit
changes in v2:
- none
--- meta/lib/oeqa/selftest/cases/wic.py | 136 ++++++++++++++++------------ 1 file changed, 76 insertions(+), 60 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +76 -60
@@ -99,6 +99,12 @@ class WicTestCase(OESelftestTestCase): WicTestCase.wicenv_cache[image] = os.path.join(stdir, machine, 'imgdata') return WicTestCase.wicenv_cache[image] + def _create_image_env_file(self, image): + bitbake('%s -c rootfs_wicenv' % image) + stagingdir = get_bb_var('STAGING_DIR', image) + machine = self.td['MACHINE'] + return os.path.join(stagingdir, machine, 'imgdata', image) + '.env' + class CLITests(WicTestCase): def test_version(self): """Test wic --version"""
@@ -175,8 +181,8 @@ class Wic(WicTestCase): with TemporaryDirectory() as tmpdir: img = 'core-image-minimal' # build the image using the WKS file - cmd = "wic create %s -e %s -o %s" % ( - wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % ( + wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(
@@ -208,7 +214,7 @@ class Wic(WicTestCase): with TemporaryDirectory() as tmpdir: img = 'core-image-minimal' # build the image using the WKS file - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname))
@@ -252,7 +258,7 @@ class Wic(WicTestCase): bitbake(img) self.remove_config(config) - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0]
@@ -271,14 +277,14 @@ class Wic(WicTestCase): def test_build_image_name(self): """Test wic create wictestdisk --image-name=core-image-minimal""" - cmd = "wic create wictestdisk --image-name=core-image-minimal -o %s" % self.resultdir + cmd = "wic create wictestdisk --image-name=core-image-minimal -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join (self.resultdir, "wictestdisk-*.direct")))) @skipIfNotArch(['i586', 'i686', 'x86_64']) def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" - cmd = "wic create directdisk-gpt --image-name core-image-minimal -o %s" % self.resultdir + cmd = "wic create directdisk-gpt --image-name core-image-minimal -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "directdisk-*.direct"))))
@@ -291,7 +297,7 @@ class Wic(WicTestCase): self.append_config(config) bitbake('core-image-minimal core-image-minimal-initramfs') self.remove_config(config) - cmd = "wic create mkhybridiso --image-name core-image-minimal -o %s" % self.resultdir + cmd = "wic create mkhybridiso --image-name core-image-minimal -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "HYBRID_ISO_IMG-*.direct")))) self.assertEqual(1, len(glob(os.path.join (self.resultdir, "HYBRID_ISO_IMG-*.iso"))))
@@ -299,14 +305,14 @@ class Wic(WicTestCase): @skipIfNotArch(['i586', 'i686', 'x86_64']) def test_qemux86_directdisk(self): """Test creation of qemux-86-directdisk image""" - cmd = "wic create qemux86-directdisk -e core-image-minimal -o %s" % self.resultdir + cmd = "wic create qemux86-directdisk -e core-image-minimal -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "qemux86-directdisk-*direct")))) @skipIfNotArch(['i586', 'i686', 'x86_64', 'aarch64']) def test_mkefidisk(self): """Test creation of mkefidisk image""" - cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir + cmd = "wic create mkefidisk -e core-image-minimal -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "mkefidisk-*direct"))))
@@ -317,7 +323,7 @@ class Wic(WicTestCase): self.append_config(config) bitbake('core-image-minimal') self.remove_config(config) - cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir + cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "directdisk-bootloader-config-*direct"))))
@@ -328,15 +334,16 @@ class Wic(WicTestCase): self.append_config(config) bitbake('core-image-minimal') self.remove_config(config) - cmd = "wic create systemd-bootdisk -e core-image-minimal -o %s" % self.resultdir + cmd = "wic create systemd-bootdisk -e core-image-minimal -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "systemd-bootdisk-*direct")))) def test_efi_bootpart(self): """Test creation of efi-bootpart image""" - cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') self.append_config('IMAGE_EFI_BOOT_FILES = "%s;kernel"\n' % kimgtype) + envfile = self._create_image_env_file('core-image-minimal') + cmd = "wic create mkefidisk -e core-image-minimal -o %s -v %s" % (self.resultdir, envfile) runCmd(cmd) sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') images = glob(os.path.join(self.resultdir, "mkefidisk-*.direct"))
@@ -345,9 +352,10 @@ class Wic(WicTestCase): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" - cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') - self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) + self.append_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) + envfile = self._create_image_env_file('core-image-minimal') + cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s -v %s" % (self.resultdir, envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "sdimage-bootpart-*direct"))))
@@ -361,7 +369,7 @@ class Wic(WicTestCase): self.append_config(config) bitbake('core-image-minimal') self.remove_config(config) - cmd = "wic create directdisk -e core-image-minimal" + cmd = "wic create directdisk -e core-image-minimal -v %s" % self.envfile runCmd(cmd) self.assertEqual(1, len(glob("directdisk-*.direct")))
@@ -374,55 +382,58 @@ class Wic(WicTestCase): 'core-image-minimal')) bbvars = {key.lower(): value for key, value in bb_vars.items()} bbvars['resultdir'] = self.resultdir + bbvars['envfile'] = self.envfile runCmd("wic create directdisk " "-b %(staging_datadir)s " "-k %(deploy_dir_image)s " "-n %(recipe_sysroot_native)s " "-r %(image_rootfs)s " - "-o %(resultdir)s" % bbvars) + "-o %(resultdir)s " + "-v %(envfile)s" % bbvars) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "directdisk-*.direct")))) def test_compress_gzip(self): """Test compressing an image with gzip""" runCmd("wic create wictestdisk " "--image-name core-image-minimal " - "-c gzip -o %s" % self.resultdir) + "-c gzip -o %s -v %s" % (self.resultdir, self.envfile)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct.gz")))) def test_compress_bzip2(self): """Test compressing an image with bzip2""" runCmd("wic create wictestdisk " "--image-name=core-image-minimal " - "-c bzip2 -o %s" % self.resultdir) + "-c bzip2 -o %s -v %s" % (self.resultdir, self.envfile)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct.bz2")))) def test_compress_xz(self): """Test compressing an image with xz""" runCmd("wic create wictestdisk " "--image-name=core-image-minimal " - "--compress-with=xz -o %s" % self.resultdir) + "--compress-with=xz -o %s -v %s" % (self.resultdir, self.envfile)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct.xz")))) def test_wrong_compressor(self): """Test how wic breaks if wrong compressor is provided""" self.assertEqual(2, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " - "-c wrong -o %s" % self.resultdir, + "-c wrong -o %s -v %s" % (self.resultdir, self.envfile), ignore_status=True).status) def test_debug_short(self): """Test -D option""" runCmd("wic create wictestdisk " "--image-name=core-image-minimal " - "-D -o %s" % self.resultdir) + "-D -o %s -v %s" % (self.resultdir, self.envfile)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct")))) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "tmp.wic*")))) def test_debug_long(self): """Test --debug option""" runCmd("wic create wictestdisk " + "--vars %s " "--image-name=core-image-minimal " - "--debug -o %s" % self.resultdir) + "--debug -o %s" % (self.envfile, self.resultdir)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct")))) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "tmp.wic*"))))
@@ -430,30 +441,32 @@ class Wic(WicTestCase): """Test -s option""" runCmd("wic create wictestdisk " "--image-name=core-image-minimal " - "-s -o %s" % self.resultdir) + "-s -o %s -v %s" % (self.resultdir, self.envfile)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct")))) def test_skip_build_check_long(self): """Test --skip-build-check option""" runCmd("wic create wictestdisk " + "--vars %s " "--image-name=core-image-minimal " "--skip-build-check " - "--outdir %s" % self.resultdir) + "--outdir %s" % (self.envfile, self.resultdir)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct")))) def test_build_rootfs_short(self): """Test -f option""" runCmd("wic create wictestdisk " "--image-name=core-image-minimal " - "-f -o %s" % self.resultdir) + "-f -o %s -v %s" % (self.resultdir, self.envfile)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct")))) def test_build_rootfs_long(self): """Test --build-rootfs option""" runCmd("wic create wictestdisk " + "--vars %s " "--image-name=core-image-minimal " "--build-rootfs " - "--outdir %s" % self.resultdir) + "--outdir %s" % (self.envfile, self.resultdir)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*.direct")))) # TODO this doesn't have to be x86-specific
@@ -461,10 +474,11 @@ class Wic(WicTestCase): def test_rootfs_indirect_recipes(self): """Test usage of rootfs plugin with rootfs recipes""" runCmd("wic create directdisk-multi-rootfs " + "--vars %s " "--image-name=core-image-minimal " "--rootfs rootfs1=core-image-minimal " "--rootfs rootfs2=core-image-minimal " - "--outdir %s" % self.resultdir) + "--outdir %s" % (self.envfile, self.resultdir)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "directdisk-multi-rootfs*.direct")))) # TODO this doesn't have to be x86-specific
@@ -478,7 +492,9 @@ class Wic(WicTestCase): bbvars = {key.lower(): value for key, value in bb_vars.items()} bbvars['wks'] = "directdisk-multi-rootfs" bbvars['resultdir'] = self.resultdir + bbvars['envfile'] = self.envfile runCmd("wic create %(wks)s " + "--vars %(envfile)s " "--bootimg-dir=%(staging_datadir)s " "--kernel-dir=%(deploy_dir_image)s " "--native-sysroot=%(recipe_sysroot_native)s "
@@ -503,8 +519,8 @@ part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr part /mnt --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/whoami --rootfs-dir %s/usr""" % (rootfs_dir, rootfs_dir, rootfs_dir)) - runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir)) + runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile)) os.remove(wks_file) wicout = glob(os.path.join(self.resultdir, "%s-*direct" % 'temp'))
@@ -641,8 +657,8 @@ part /mnt --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/whoa part /part1 --source rootfs --ondisk mmcblk0 --fstype=ext4 part /part2 --source rootfs --ondisk mmcblk0 --fstype=ext4 --include-path %s""" % (include_path)) - runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir)) + runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile)) part1 = glob(os.path.join(self.resultdir, 'temp-*.direct.p1'))[0] part2 = glob(os.path.join(self.resultdir, 'temp-*.direct.p2'))[0]
@@ -678,8 +694,8 @@ part /part2 --source rootfs --ondisk mmcblk0 --fstype=ext4 --include-path %s""" wks.write(""" part / --source rootfs --fstype=ext4 --include-path %s --include-path core-image-minimal-mtdutils export/""" % (include_path)) - runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir)) + runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile)) part1 = glob(os.path.join(self.resultdir, 'temp-*.direct.p1'))[0]
@@ -703,22 +719,22 @@ part / --source rootfs --fstype=ext4 --include-path %s --include-path core-imag # Absolute argument. with open(wks_file, 'w') as wks: wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils /export") - self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir), ignore_status=True).status) + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile), ignore_status=True).status) os.remove(wks_file) # Argument pointing to parent directory. with open(wks_file, 'w') as wks: wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils ././..") - self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir), ignore_status=True).status) + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile), ignore_status=True).status) os.remove(wks_file) # 3 Argument pointing to parent directory. with open(wks_file, 'w') as wks: wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils export/ dummy") - self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir), ignore_status=True).status) + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile), ignore_status=True).status) os.remove(wks_file) def test_exclude_path_errors(self):
@@ -728,15 +744,15 @@ part / --source rootfs --fstype=ext4 --include-path %s --include-path core-imag # Absolute argument. with open(wks_file, 'w') as wks: wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path /usr") - self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir), ignore_status=True).status) + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile), ignore_status=True).status) os.remove(wks_file) # Argument pointing to parent directory. with open(wks_file, 'w') as wks: wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path ././..") - self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir), ignore_status=True).status) + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile), ignore_status=True).status) os.remove(wks_file) def test_permissions(self):
@@ -771,8 +787,8 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc wks_file = os.path.join(include_path, 'temp.wks') with open(wks_file, 'w') as wks: wks.write(test) - runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir)) + runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile)) for part in glob(os.path.join(self.resultdir, 'temp-*.direct.p*')): res = runCmd("debugfs -R 'ls -p' %s" % (part), stderr=subprocess.PIPE)
@@ -808,8 +824,8 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc wks_file = os.path.join(include_path, 'temp.wks') with open(wks_file, 'w') as wks: wks.write("part /etc --source rootfs --fstype=ext4 --change-directory=etc") - runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir)) + runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile)) part1 = glob(os.path.join(self.resultdir, 'temp-*.direct.p1'))[0]
@@ -827,8 +843,8 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc # Absolute argument. with open(wks_file, 'w') as wks: wks.write("part / --source rootfs --fstype=ext4 --change-directory /usr") - self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir), ignore_status=True).status) + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile), ignore_status=True).status) os.remove(wks_file) # Argument pointing to parent directory.
@@ -858,8 +874,8 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc wks.writelines(['part / --source rootfs --fstype=ext4 --label rootfs\n', 'part /mnt/p2 --source rootfs --rootfs-dir=core-image-minimal ', '--fstype=ext4 --label p2 --no-fstab-update\n']) - runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir)) + runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile)) part_fstab_md5sum = [] for i in range(1, 3):
@@ -884,15 +900,15 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc # Absolute argument. with open(wks_file, 'w') as wks: wks.write("part / --source rootfs --fstype=ext4 --no-fstab-update /etc") - self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir), ignore_status=True).status) + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile), ignore_status=True).status) os.remove(wks_file) # Argument pointing to parent directory. with open(wks_file, 'w') as wks: wks.write("part / --source rootfs --fstype=ext4 --no-fstab-update ././..") - self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir), ignore_status=True).status) + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile), ignore_status=True).status) os.remove(wks_file) def test_extra_space(self):
@@ -900,7 +916,7 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc extraspace = 1024**3 runCmd("wic create wictestdisk " "--image-name core-image-minimal " - "--extra-space %i -o %s" % (extraspace ,self.resultdir)) + "--extra-space %i -o %s -v %s" % (extraspace ,self.resultdir, self.envfile)) wicout = glob(os.path.join(self.resultdir, "wictestdisk-*.direct")) self.assertEqual(1, len(wicout)) size = os.path.getsize(wicout[0])
@@ -913,7 +929,7 @@ part /etc --source rootfs --fstype=ext4 --change-directory=etc # Absolute argument. with open(wks_file, 'w') as wks: wks.write("part testspace --no-table --fixed-size 16k --offset 4080k") - runCmd("wic create %s --image-name core-image-minimal -o %s" % (wks_file, self.resultdir)) + runCmd("wic create %s --image-name core-image-minimal -o %s -v %s" % (wks_file, self.resultdir, self.envfile)) wicout = glob(os.path.join(self.resultdir, "*.*"))
@@ -934,8 +950,8 @@ part / --source rootfs --fstype=ext4 part / --source rootfs --fstype=ext4 --hidden bootloader --ptable gpt""") - runCmd("wic create %s -e core-image-minimal -o %s" \ - % (wks_file, self.resultdir)) + runCmd("wic create %s -e core-image-minimal -o %s -v %s" \ + % (wks_file, self.resultdir, self.envfile)) wicout = os.path.join(self.resultdir, "*.direct") result = runCmd("%s/usr/sbin/sfdisk --part-attrs %s 1" % (sysroot, wicout))
@@ -961,7 +977,7 @@ bootloader --ptable gpt""") 'part --fstype ext4 --source rootfs --label rofs-a\n', 'part --fstype ext4 --source rootfs --use-uuid\n']) wks.flush() - cmd = "wic create %s -e core-image-minimal -o %s --sector-size 4096" % (wks.name, self.resultdir) + cmd = "wic create %s -e core-image-minimal -o %s --sector-size 4096 -v %s" % (wks.name, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] images = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
Signature · 1 line
2.51.0
PATCH v6 9/9 oe-selftest/cases/wic.py: oe-selftest -r wic.Wic2 -> PASS
In reply to Trevor WoernerChanges for the wic.Wic2 oe-selftests to pass now that wic is a stand-alone app and no longer part of oe-core.
NOTE: the wic.Wic2.test_sparse_copy test was deleted since it tests code
that is internal to wic itself; which is no longer possible now that wic is not part of oe-core.
---
changes in v6:
- removed extraopts options that specify sector-size values for dos and ext* partition types
changes in v5:
- rebase with master
- re-split up into multiple, smaller patches
- now that the sector-size re-implementation is ahead of this patch, various wic subcommands (ls, cp, rm) no longer need a --vars file
- combine qemu and non-qemu patches together (were separate patches)
v4: skipped to align/combine with other patch set
changes in v3:
- squashed into 1 large commit
changes in v2:
- none
--- meta/lib/oeqa/selftest/cases/wic.py | 74 ++++++++++------------------- 1 file changed, 26 insertions(+), 48 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +26 -48
@@ -1005,14 +1005,14 @@ class Wic2(WicTestCase): def test_bmap_short(self): """Test generation of .bmap file -m option""" - cmd = "wic create wictestdisk -e core-image-minimal -m -o %s" % self.resultdir + cmd = "wic create wictestdisk -e core-image-minimal -m -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct")))) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct.bmap")))) def test_bmap_long(self): """Test generation of .bmap file --bmap option""" - cmd = "wic create wictestdisk -e core-image-minimal --bmap -o %s" % self.resultdir + cmd = "wic create wictestdisk -e core-image-minimal --bmap -o %s -v %s" % (self.resultdir, self.envfile) runCmd(cmd) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct")))) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct.bmap"))))
@@ -1048,9 +1048,9 @@ class Wic2(WicTestCase): native_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "wic-tools") runCmd("wic create wictestdisk " - "--image-name=%s -v %s -n %s -o %s" + "--image-name=%s -v %s -n %s -o %s -v %s" % (image, imgenvdir, native_sysroot, - self.resultdir)) + self.resultdir, self.envfile)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct")))) def test_image_vars_dir_long(self):
@@ -1063,9 +1063,10 @@ class Wic2(WicTestCase): "--image-name=%s " "--vars %s " "--native-sysroot %s " - "--outdir %s" + "--outdir %s " + "--vars %s" % (image, imgenvdir, native_sysroot, - self.resultdir)) + self.resultdir, self.envfile)) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "wictestdisk-*direct")))) # TODO this test could also work on aarch64
@@ -1075,6 +1076,7 @@ class Wic2(WicTestCase): config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ 'MACHINE_FEATURES:append = " efi"\n' image_recipe_append = """ +DEPENDS:append = " wic-native" do_image_wic[postfuncs] += "run_wic_cmd" run_wic_cmd() { echo "test" >> ${WORKDIR}/test.wic-cp
@@ -1115,6 +1117,7 @@ run_wic_cmd() { 'MACHINE_FEATURES:append = " efi"\n' self.append_config(config) image_recipe_append = """ +DEPENDS:append = " wic-native" do_image_wic[postfuncs] += "run_wic_cmd" run_wic_cmd() { echo "test" >> ${WORKDIR}/test.wic-cp
@@ -1179,7 +1182,7 @@ run_wic_cmd() { return wkspath def _get_wic(self, wkspath, ignore_status=False): - p = runCmd("wic create %s -e core-image-minimal -o %s" % (wkspath, self.resultdir), + p = runCmd("wic create %s -e core-image-minimal -o %s -v %s" % (wkspath, self.resultdir, self.envfile), ignore_status=ignore_status) if p.status:
@@ -1420,7 +1423,7 @@ run_wic_cmd() { wks.write('part / --source rawcopy --sourceparams="file=%s.%s%s"\n'\ % (bb_vars['IMAGE_LINK_NAME'], fstype, params)) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, image, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, image, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1513,7 +1516,7 @@ run_wic_cmd() { 'part / --source rootfs --fstype=ext4 --align 1024 --use-uuid\n'\ 'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n']) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname))
@@ -1525,6 +1528,7 @@ run_wic_cmd() { config = 'IMAGE_EFI_BOOT_FILES="/etc/fstab;testfile"\nIMAGE_FSTYPES = "wic"\nWKS_FILE = "test_uefikernel.wks"\nMACHINE_FEATURES:append = " efi"\n' self.append_config(config) bitbake('core-image-minimal') + envfile = self._create_image_env_file('core-image-minimal') self.remove_config(config) img = 'core-image-minimal'
@@ -1533,7 +1537,7 @@ run_wic_cmd() { 'part / --source rootfs --fstype=ext4 --align 1024 --use-uuid\n'\ 'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n']) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname))
@@ -1678,6 +1682,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" " """) self.append_config(config) + self.envfile = self._create_image_env_file('core-image-minimal') deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE') sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
@@ -1748,7 +1753,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" 'part emptyext2 --fstype ext2 --size 1M\n', 'part emptybtrfs --fstype btrfs --size 150M\n']) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1760,7 +1765,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" wks.writelines(['part / --fstype ext3 --source rootfs --system-id 0xFF '\ '--overhead-factor 1.2 --size 100k\n']) wks.flush() - cmd = "wic create %s -e core-image-minimal -o %s" % (wks.name, self.resultdir) + cmd = "wic create %s -e core-image-minimal -o %s -v %s" % (wks.name, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1769,41 +1774,14 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" def test_image_bootpart_globbed(self): """Test globbed sources with image-bootpart plugin""" img = "core-image-minimal" - cmd = "wic create sdimage-bootpart -e %s -o %s" % (img, self.resultdir) config = 'IMAGE_BOOT_FILES = "%s*"' % get_bb_var('KERNEL_IMAGETYPE', img) self.append_config(config) + envfile = self._create_image_env_file(img) + cmd = "wic create sdimage-bootpart -e %s -o %s -v %s" % (img, self.resultdir, envfile) runCmd(cmd) self.remove_config(config) self.assertEqual(1, len(glob(os.path.join(self.resultdir, "sdimage-bootpart-*direct")))) - def test_sparse_copy(self): - """Test sparse_copy with FIEMAP and SEEK_HOLE filemap APIs""" - libpath = os.path.join(self.td['COREBASE'], 'scripts', 'lib', 'wic') - sys.path.insert(0, libpath) - from filemap import FilemapFiemap, FilemapSeek, sparse_copy, ErrorNotSupp - with NamedTemporaryFile("w", suffix=".wic-sparse") as sparse: - src_name = sparse.name - src_size = 1024 * 10 - sparse.truncate(src_size) - # write one byte to the file - with open(src_name, 'r+b') as sfile: - sfile.seek(1024 * 4) - sfile.write(b'\x00') - dest = sparse.name + '.out' - # copy src file to dest using different filemap APIs - for api in (FilemapFiemap, FilemapSeek, None): - if os.path.exists(dest): - os.unlink(dest) - try: - sparse_copy(sparse.name, dest, api=api) - except ErrorNotSupp: - continue # skip unsupported API - dest_stat = os.stat(dest) - self.assertEqual(dest_stat.st_size, src_size) - # 8 blocks is 4K (physical sector size) - self.assertEqual(dest_stat.st_blocks, 8) - os.unlink(dest) - def test_mkfs_extraopts(self): """Test wks option --mkfs-extraopts for empty and not empty partitions""" img = 'core-image-minimal'
@@ -1812,12 +1790,12 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" ['part ext2 --fstype ext2 --source rootfs --mkfs-extraopts "-D -F -i 8192"\n', "part btrfs --fstype btrfs --source rootfs --size 40M --mkfs-extraopts='--quiet'\n", 'part squash --fstype squashfs --source rootfs --mkfs-extraopts "-no-sparse -b 4096"\n', - 'part emptyvfat --fstype vfat --size 1M --mkfs-extraopts "-S 1024 -s 64"\n', - 'part emptymsdos --fstype msdos --size 1M --mkfs-extraopts "-S 1024 -s 64"\n', + 'part emptyvfat --fstype vfat --size 1M --mkfs-extraopts "-s 64"\n', + 'part emptymsdos --fstype msdos --size 1M --mkfs-extraopts "-s 64"\n', 'part emptyext2 --fstype ext2 --size 1M --mkfs-extraopts "-D -F -i 8192"\n', 'part emptybtrfs --fstype btrfs --size 100M --mkfs-extraopts "--mixed -K"\n']) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1916,7 +1894,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" 'part empty --source empty --sourceparams="size=2048k,bs=512K" --ondisk sda --size 4M --align 1024\n' ]) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] wicout = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1934,7 +1912,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" with NamedTemporaryFile("w", suffix=".wks") as wks: wks.writelines(['part empty --source empty --sourceparams="fill" --ondisk sda --size 1M\n']) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) result = runCmd(cmd, ignore_status=True) self.assertIn("Source parameter 'fill' only works with the '--fixed-size' option, exiting.", result.output) self.assertNotEqual(0, result.status)
@@ -1948,7 +1926,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" 'part /boot --size=100M --active --fstype=ext4 --label boot\n' 'part / --source rootfs --fstype=ext4 --label root\n']) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
@@ -1966,7 +1944,7 @@ INITRAMFS_IMAGE = "core-image-initramfs-boot" 'part /boot --size=100M --active --fstype=ext4 --label boot\n' 'part / --source rootfs --fstype=ext4 --label root\n']) wks.flush() - cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + cmd = "wic create %s -e %s -o %s -v %s" % (wks.name, img, self.resultdir, self.envfile) runCmd(cmd) wksname = os.path.splitext(os.path.basename(wks.name))[0] out = glob(os.path.join(self.resultdir, "%s-*direct" % wksname))
Signature · 1 line
2.51.0
Quoted 61 lines · Trevor Woerner via lists.openembedded.org
This series of patches splits wic out from oe-core into its own standalone utility. The wic utility will continue to be under The Yocto Project umbrella, but will no longer be integrated into the project as part of oe-core. The ultimate goal is to make wic a completely independent tool, hosted on PyPI, with its own tests, development roadmap, and releases.
Some benefits include:
- relieving the oe-core maintainers from having to review wic patches
- allow the tool to be used outside of The Yocto Project
- provide more flexibility to explore other features, libraries, mechanisms, etcThese changes have been tested with oe-selftest as follows:
$ sudo .../layers/openembedded-core/scripts/runqemu-gen-tapdevs <my numeric group id> 4 $ oe-selftest -v -r wicPreviously, I had two separate patch sets for wic on oe-core: one to create a standalone utility, and one to re-implement variable sector-size handling. Both these were combined to create a combined "v5" patch set.
In v6 the major changes are:
- code cleanups to remove cases of "ifsector_sizeandsector_size= 512" in places where we can guaranteesector_sizewill exist
- cleanups to replace "getattr(var, 'sector_size', 512)or 512" since the 3rd arg togetattr()is already setting a default if the variable name is not found
- many comment and commit comment improvements
- error out if extraopts includes options to set the sector-size in wks files
- patch 2 (add ufs class) was dropped
- patches 3 and 4 were reversed (move/save wks files before removing the rest of wic from oe-core)For the patch sets up to and including v5:
For the standalone patch set:
v1: an RFC patchset was sent out, split up into small patches for easy
review
v2: add wic utility to list of native dependencies of
image_types_wic.bbclass
v3: squash all commits together to apply atomically
v4: (does not exist)
v5: rebase on latest master
split commits back out acknowledging any bisection that lands between them will fail
combine with sector-size patchFor the sector-size patch:
v1: initial patch set
v2: add Mark as co-author of ufs class
try to fix a build warning when not using wic
v3: actually fix warning when not using wic
v4: deprecate, but allow,WIC_SECTOR_SIZEto continue to be used to set
the sector-size both from config files and the environment warn when both are used, but prefer cmdline value
change partition type of sample wks to gpt
v5: fix a bug whereWIC_SECTOR_SIZEis not given anywhere
combine with standalone patch set
Quoted 1 line
Trevor Woerner (9):
Hi Trevor,
Thanks for the new version.
We have some test failure as the wic tool is not found in path. I believe we already discussed that previously, but I'm not sure what was the conclusion.
Poky - The Yocto Project testing distribution
Running '. ./init-build-env; wic create directdisk -e core-image-sato -o ${BUILDDIR}/tmp/deploy/wic_images/qemux86/directdisk/core-image-sato/' with output to /srv/pokybuild/yocto-worker/wic/build/build/command-1-cmds.log in /srv/pokybuild/yocto-worker/wic/build/build /bin/bash: line 1: wic: command not found
https://autobuilder.yoctoproject.org/valkyrie/#/builders/15/builds/3190
I will let other tests finish, so we can have an overview of the situation.
Thanks,
Mathieu
Signature · 3 lines
Mathieu Dubois-Briand, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 72 lines · Mathieu Dubois-Briand
Quoted 61 lines · Trevor Woerner via lists.openembedded.org
This series of patches splits wic out from oe-core into its own standalone utility. The wic utility will continue to be under The Yocto Project umbrella, but will no longer be integrated into the project as part of oe-core. The ultimate goal is to make wic a completely independent tool, hosted on PyPI, with its own tests, development roadmap, and releases.
Some benefits include:
- relieving the oe-core maintainers from having to review wic patches
- allow the tool to be used outside of The Yocto Project
- provide more flexibility to explore other features, libraries, mechanisms, etcThese changes have been tested with oe-selftest as follows:
$ sudo .../layers/openembedded-core/scripts/runqemu-gen-tapdevs <my numeric group id> 4 $ oe-selftest -v -r wicPreviously, I had two separate patch sets for wic on oe-core: one to create a standalone utility, and one to re-implement variable sector-size handling. Both these were combined to create a combined "v5" patch set.
In v6 the major changes are:
- code cleanups to remove cases of "ifsector_sizeandsector_size= 512" in places where we can guaranteesector_sizewill exist
- cleanups to replace "getattr(var, 'sector_size', 512)or 512" since the 3rd arg togetattr()is already setting a default if the variable name is not found
- many comment and commit comment improvements
- error out if extraopts includes options to set the sector-size in wks files
- patch 2 (add ufs class) was dropped
- patches 3 and 4 were reversed (move/save wks files before removing the rest of wic from oe-core)For the patch sets up to and including v5:
For the standalone patch set:
v1: an RFC patchset was sent out, split up into small patches for easy
review
v2: add wic utility to list of native dependencies of
image_types_wic.bbclass
v3: squash all commits together to apply atomically
v4: (does not exist)
v5: rebase on latest master
split commits back out acknowledging any bisection that lands between them will fail
combine with sector-size patchFor the sector-size patch:
v1: initial patch set
v2: add Mark as co-author of ufs class
try to fix a build warning when not using wic
v3: actually fix warning when not using wic
v4: deprecate, but allow,WIC_SECTOR_SIZEto continue to be used to set
the sector-size both from config files and the environment warn when both are used, but prefer cmdline value
change partition type of sample wks to gpt
v5: fix a bug whereWIC_SECTOR_SIZEis not given anywhere
combine with standalone patch setQuoted 1 line
Trevor Woerner (9):
Hi Trevor,
Thanks for the new version.
We have some test failure as the wic tool is not found in path. I believe we already discussed that previously, but I'm not sure what was the conclusion.
Quoted 8 lines
Poky - The Yocto Project testing distribution
Running '. ./init-build-env; wic create directdisk -e core-image-sato -o ${BUILDDIR}/tmp/deploy/wic_images/qemux86/directdisk/core-image-sato/' with output to/srv/pokybuild/yocto-worker/wic/build/build/command-1-cmds.login/srv/pokybuild/yocto-worker/wic/build/build/bin/bash: line 1: wic: command not foundhttps://autobuilder.yoctoproject.org/valkyrie/#/builders/15/builds/3190
I will let other tests finish, so we can have an overview of the situation.
Thanks for the report.
Are these failures from oe-selftests defined in oe-core? I can't quite figure out which tests these are.
Quoted 48 lines · Trevor Woerner via lists.openembedded.org
This series of patches splits wic out from oe-core into its own standalone utility. The wic utility will continue to be under The Yocto Project umbrella, but will no longer be integrated into the project as part of oe-core. The ultimate goal is to make wic a completely independent tool, hosted on PyPI, with its own tests, development roadmap, and releases.
Some benefits include:
- relieving the oe-core maintainers from having to review wic patches
- allow the tool to be used outside of The Yocto Project
- provide more flexibility to explore other features, libraries, mechanisms, etcThese changes have been tested with oe-selftest as follows:
$ sudo .../layers/openembedded-core/scripts/runqemu-gen-tapdevs <my numeric group id> 4 $ oe-selftest -v -r wicPreviously, I had two separate patch sets for wic on oe-core: one to create a standalone utility, and one to re-implement variable sector-size handling. Both these were combined to create a combined "v5" patch set.
In v6 the major changes are:
- code cleanups to remove cases of "ifsector_sizeandsector_size= 512" in places where we can guaranteesector_sizewill exist
- cleanups to replace "getattr(var, 'sector_size', 512)or 512" since the 3rd arg togetattr()is already setting a default if the variable name is not found
- many comment and commit comment improvements
- error out if extraopts includes options to set the sector-size in wks files
- patch 2 (add ufs class) was dropped
- patches 3 and 4 were reversed (move/save wks files before removing the rest of wic from oe-core)For the patch sets up to and including v5:
For the standalone patch set:
v1: an RFC patchset was sent out, split up into small patches for easy
review
v2: add wic utility to list of native dependencies of
image_types_wic.bbclass
v3: squash all commits together to apply atomically
v4: (does not exist)
v5: rebase on latest master
split commits back out acknowledging any bisection that lands between them will fail
combine with sector-size patch
Quoted 12 lines
For the sector-size patch:
v1: initial patch set
v2: add Mark as co-author of ufs class
try to fix a build warning when not using wic
v3: actually fix warning when not using wic
v4: deprecate, but allow,WIC_SECTOR_SIZEto continue to be used to set
the sector-size both from config files and the environment warn when both are used, but prefer cmdline value
change partition type of sample wks to gpt
v5: fix a bug whereWIC_SECTOR_SIZEis not given anywhere
combine with standalone patch set
Hi Trevor,
I have another one, a bit more tricky. Two errors:
2026-02-26 15:48:07,027 - oe-selftest - INFO - wic.ModifyTests.test_wic_cp_ext (subunit.RemotedTestCase)
2026-02-26 15:48:07,027 - oe-selftest - INFO - ... FAIL
...
2026-02-26 15:48:07,032 - oe-selftest - INFO - 9: 73/77 513/669 (24.92s) (0 failed) (wic.ModifyTests.test_wic_cp_ext)
2026-02-26 15:48:07,032 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/wic.py", line 2127, in test_wic_cp_ext
self.assertNotIn("Ext2 inode is not a directory", result.output,
File "/usr/lib64/python3.12/unittest/case.py", line 1159, in assertNotIn
self.fail(self._formatMessage(msg, standardMsg))
File "/usr/lib64/python3.12/unittest/case.py", line 715, in fail
raise self.failureException(msg)AssertionError: 'Ext2 inode is not a directory' unexpectedly found in 'debugfs 1.47.3 (8-Jul-2025)\n-l: Ext2 inode is not a directory' : Regression detected (inode not a directory). Output:
debugfs 1.47.3 (8-Jul-2025)
-l: Ext2 inode is not a directory
...
2026-02-26 16:03:49,379 - oe-selftest - INFO - wic.Wic2.test_expand_mbr_image (subunit.RemotedTestCase)
2026-02-26 16:03:49,380 - oe-selftest - INFO - ... FAIL
...
2026-02-26 16:03:49,380 - oe-selftest - INFO - 11: 31/52 617/669 (80.30s) (0 failed) (wic.Wic2.test_expand_mbr_image)
2026-02-26 16:03:49,380 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/layers/openembedded-core/meta/lib/oeqa/core/decorator/__init__.py", line 35, in wrapped_f
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/wic.py", line 1830, in test_expand_mbr_image
runCmd(cmd)
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/layers/openembedded-core/meta/lib/oeqa/utils/commands.py", line 214, in runCmd
raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output))AssertionError: Command 'wic write -n /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native --expand 1:0 /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.wic /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/deploy/images/qemux86-64/tmpwiadp9sz.wic.exp' returned non-zero exit status 1:
[engine.py:589] INFO: copying unchanged partition 1
[engine.py:602] INFO: resizing ext partition 2
Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/bin/wic", line 8, in <module>
sys.exit(main())
~~~~^^
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/cli.py", line 631, in main
return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/help.py", line 83, in invoke_subcommand
subcmd[0](args, usage)
~~~~~~~~~^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/cli.py", line 298, in wic_write_subcommand
engine.wic_write(args, args.native_sysroot)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/engine.py", line 686, in wic_write
disk.write(args.target, args.expand)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/engine.py", line 605, in write
exec_cmd("{} -pf {}".format(self.e2fsck, partfname))
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/misc.py", line 116, in exec_cmd
return _exec_cmd(cmd_and_args, as_shell)[1]
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/misc.py", line 103, in _exec_cmd
raise WicError("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \
(cmd_and_args, ret, out))wic.WicError: _exec_cmd: /srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/sbin/e2fsck -pf /tmp/wic-part2-44outsk3 returned '1' instead of 0
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3161
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3170
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3164
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3166
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3165
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3169
Now the tricky part: this only seems happen on Fedora. I did test on various versions, and it looks like all version from 39 to 43 show the issue on the autobuilder. This was never seen in any oe-selftest-debian build.
I tried another build without this series and I confirm the issue is gone.
Can you have a look at what is wrong here?
Thanks,
Mathieu
Signature · 3 lines
Mathieu Dubois-Briand, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 135 lines · Mathieu Dubois-Briand
Quoted 48 lines · Trevor Woerner via lists.openembedded.org
This series of patches splits wic out from oe-core into its own standalone utility. The wic utility will continue to be under The Yocto Project umbrella, but will no longer be integrated into the project as part of oe-core. The ultimate goal is to make wic a completely independent tool, hosted on PyPI, with its own tests, development roadmap, and releases.
Some benefits include:
- relieving the oe-core maintainers from having to review wic patches
- allow the tool to be used outside of The Yocto Project
- provide more flexibility to explore other features, libraries, mechanisms, etcThese changes have been tested with oe-selftest as follows:
$ sudo .../layers/openembedded-core/scripts/runqemu-gen-tapdevs <my numeric group id> 4 $ oe-selftest -v -r wicPreviously, I had two separate patch sets for wic on oe-core: one to create a standalone utility, and one to re-implement variable sector-size handling. Both these were combined to create a combined "v5" patch set.
In v6 the major changes are:
- code cleanups to remove cases of "ifsector_sizeandsector_size= 512" in places where we can guaranteesector_sizewill exist
- cleanups to replace "getattr(var, 'sector_size', 512)or 512" since the 3rd arg togetattr()is already setting a default if the variable name is not found
- many comment and commit comment improvements
- error out if extraopts includes options to set the sector-size in wks files
- patch 2 (add ufs class) was dropped
- patches 3 and 4 were reversed (move/save wks files before removing the rest of wic from oe-core)For the patch sets up to and including v5:
For the standalone patch set:
v1: an RFC patchset was sent out, split up into small patches for easy
review
v2: add wic utility to list of native dependencies of
image_types_wic.bbclass
v3: squash all commits together to apply atomically
v4: (does not exist)
v5: rebase on latest master
split commits back out acknowledging any bisection that lands between them will fail
combine with sector-size patchQuoted 12 lines
For the sector-size patch:
v1: initial patch set
v2: add Mark as co-author of ufs class
try to fix a build warning when not using wic
v3: actually fix warning when not using wic
v4: deprecate, but allow,WIC_SECTOR_SIZEto continue to be used to set
the sector-size both from config files and the environment warn when both are used, but prefer cmdline value
change partition type of sample wks to gpt
v5: fix a bug whereWIC_SECTOR_SIZEis not given anywhere
combine with standalone patch setHi Trevor,
I have another one, a bit more tricky. Two errors:
2026-02-26 15:48:07,027 - oe-selftest - INFO - wic.ModifyTests.test_wic_cp_ext (subunit.RemotedTestCase) 2026-02-26 15:48:07,027 - oe-selftest - INFO - ... FAIL ... 2026-02-26 15:48:07,032 - oe-selftest - INFO - 9: 73/77 513/669 (24.92s) (0 failed) (wic.ModifyTests.test_wic_cp_ext) 2026-02-26 15:48:07,032 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last): File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/wic.py", line 2127, in test_wic_cp_ext self.assertNotIn("Ext2 inode is not a directory", result.output, File "/usr/lib64/python3.12/unittest/case.py", line 1159, in assertNotIn self.fail(self._formatMessage(msg, standardMsg)) File "/usr/lib64/python3.12/unittest/case.py", line 715, in fail raise self.failureException(msg)AssertionError: 'Ext2 inode is not a directory' unexpectedly found in 'debugfs 1.47.3 (8-Jul-2025)\n-l: Ext2 inode is not a directory' : Regression detected (inode not a directory). Output:
debugfs 1.47.3 (8-Jul-2025)
-l: Ext2 inode is not a directory
...2026-02-26 16:03:49,379 - oe-selftest - INFO - wic.Wic2.test_expand_mbr_image (subunit.RemotedTestCase) 2026-02-26 16:03:49,380 - oe-selftest - INFO - ... FAIL ... 2026-02-26 16:03:49,380 - oe-selftest - INFO - 11: 31/52 617/669 (80.30s) (0 failed) (wic.Wic2.test_expand_mbr_image) 2026-02-26 16:03:49,380 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last): File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/layers/openembedded-core/meta/lib/oeqa/core/decorator/__init__.py", line 35, in wrapped_f return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/wic.py", line 1830, in test_expand_mbr_image runCmd(cmd) File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/layers/openembedded-core/meta/lib/oeqa/utils/commands.py", line 214, in runCmd raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output))AssertionError: Command 'wic write -n
/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native--expand 1:0/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.wic/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/deploy/images/qemux86-64/tmpwiadp9sz.wic.exp' returned non-zero exit status 1:
[engine.py:589] INFO: copying unchanged partition 1
[engine.py:602] INFO: resizing ext partition 2
Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/bin/wic", line 8, in <module>sys.exit(main()) ~~~~^^ File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/cli.py", line 631, in main return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/help.py", line 83, in invoke_subcommand subcmd[0](args, usage) ~~~~~~~~~^^^^^^^^^^^^^ File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/cli.py", line 298, in wic_write_subcommand engine.wic_write(args, args.native_sysroot) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/engine.py", line 686, in wic_write disk.write(args.target, args.expand) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/engine.py", line 605, in write exec_cmd("{} -pf {}".format(self.e2fsck, partfname)) ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/misc.py", line 116, in exec_cmd return _exec_cmd(cmd_and_args, as_shell)[1] ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/usr/lib/python3.14/site-packages/wic/misc.py", line 103, in _exec_cmd raise WicError("_exec_cmd: %s returned '%s' instead of 0\noutput: %s" % \ (cmd_and_args, ret, out))wic.WicError:
_exec_cmd:/srv/pokybuild/yocto-worker/oe-selftest-fedora/build/build-st-2592824/tmp/work/x86-64-v3-poky-linux/wic-tools/1.0/recipe-sysroot-native/sbin/e2fsck-pf/tmp/wic-part2-44outsk3returned '1' instead of 0https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3161
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3170
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3164
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3166
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3165
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3169Now the tricky part: this only seems happen on Fedora. I did test on various versions, and it looks like all version from 39 to 43 show the issue on the autobuilder. This was never seen in any oe-selftest-debian build.
Quoted 4 lines
I tried another build without this series and I confirm the issue is gone.
Can you have a look at what is wrong here?
Yes, thanks. The good news is I see these exact same errors on my home machine, OpenSUSE Leap 16.0. That's why I sent the RFC set a while back to try to determine if these were general issues or something specific to my machine. When the RFC set passed I assumed it was a problem on my machine and didn't go further trying to debug.
The first test fails for me at home without any of my patches, so there's probably something funny going on there.
The second failure (e2fsck) is interesting. wic assumes that any non-zero return value from any external command it invokes is a failure. But in the case of e2fsck a zero means success and no fixups were needed, and a return value of 1 means success but there were fixes that were needed (and the filesystem is now clean) for example:
deleted/unused inodes, fixed refcounts. For some reason, when I (and Fedora too it seems) create the image, it seems to be in need of some e2fsck fixups even though the filesystem is completely new and never mounted. It could be related to host kernel filesystem handling, the filesystem type on which the image is created, or perhaps the type of disk that is used. In my case I'm generating these images on an nvme drive, maybe that's significant?
In both cases the fixes should be straight-forward, now that I know they're general bugs and not something specific to my setup at home.
Thanks!