Jelajahi Sumber

image_types_wic: fix dependencies on wks files

Add dependencies on all eligible files in WKS_SEARCH_PATH.

Before this patch, adding a wks file earlier in the search path
was not taken into account automatically.

To reproduce the issue:

1. Init (use default WKS_FILE="qemux86-directdisk.wks")

    . oe-init-build-env
    echo 'IMAGE_FSTYPES += "wic"' >> conf/local.conf

2. First clean build

    rm -f wic/qemux86-directdisk.wks
    bitbake core-image-minimal -c cleansstate && bitbake core-image-minimal

3. Create an override for WKS_FILE (earlier in WKS_SEARCH_PATH)
and introduce an error (a very small partition size) so that we can see it happen (or not).

    mkdir -p wic
    echo "part / --source rootfs --fstype=ext4 --fixed-size 1M" > wic/qemux86-directdisk.wks

4. Build again

    bitbake core-image-minimal
    ...
    NOTE: Tasks Summary: Attempted 4670 tasks of which 4670 didn't need to be rerun and all succeeded.

=> Nothing gets built, whereas we should see this error:
| ERROR: Actual rootfs size (28713 kB) is larger than allowed size 1024 kB

(From OE-Core rev: 6450761110d071313ce1d44578f8adcce416dc65)

Signed-off-by: Frederic Hoerni <fhoerni@witekio.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Frederic Hoerni 1 Minggu lalu
induk
melakukan
4d7c49e37f
1 mengubah file dengan 4 tambahan dan 14 penghapusan
  1. 4 14
      meta/classes-recipe/image_types_wic.bbclass

+ 4 - 14
meta/classes-recipe/image_types_wic.bbclass

@@ -45,17 +45,11 @@ 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_FULL_PATH = "${@wks_search(d.getVar('WKS_FILES').split(), d.getVar('WKS_SEARCH_PATH')) or ''}"
+WKS_FULL_PATH = "${@wks_search(d.getVar('WKS_FILES').split(), d.getVar('WKS_SEARCH_PATH'), d) or ''}"
 
-def wks_search(files, search_path):
-    for f in files:
-        if os.path.isabs(f):
-            if os.path.exists(f):
-                return f
-        else:
-            searched = bb.utils.which(search_path, f)
-            if searched:
-                return searched
+def wks_search(files, search_path, d):
+    from oe.searchfile import search_file
+    return search_file(search_path, files, d)
 
 WIC_CREATE_EXTRA_ARGS ?= ""
 
@@ -160,10 +154,6 @@ python () {
             d.setVar('WKS_TEMPLATE_PATH', wks_file_u)
             d.setVar('WKS_FILE_CHECKSUM', '${WKS_TEMPLATE_PATH}:True')
 
-            # We need to re-parse each time the file changes, and bitbake
-            # needs to be told about that explicitly.
-            bb.parse.mark_dependency(d, wks_file)
-
             try:
                 with open(wks_file, 'r') as f:
                     body = f.read()