Convert to new override syntax
[AGL/meta-agl.git] / meta-agl-core / classes / image_types_wic_workaround.bbclass
1 # This is a workaround for the race condition between do_image_wic and other
2 # do_image_* tasks. It ensures that no other do_image_* task can be running and
3 # reading the rootfs directory at the same time as do_image_wic is modifying
4 # the /etc/fstab file in the rootfs directory.
5 #
6 # A much better fix has been submitted upstream [1], but we can't carry those
7 # modifications to `scripts/lib/wic` from poky easily in meta-agl. So instead
8 # we have this workaround until the upstream fix is accepted and backported.
9 #
10 # Serializing the image functions as done here impacts build speed but it's
11 # better to be slow and correct than to be fast and wrong.
12 #
13 # [1]: https://lists.openembedded.org/g/openembedded-core/topic/patch_5_6_wic_copy_rootfs/79592787,
14 #      https://lists.openembedded.org/g/openembedded-core/topic/patch_6_6_wic_optimise/79592788
15 #      and related patches.
16 #
17 # Bug-AGL: SPEC-3621
18
19 def get_workaround_wic_typedeps(d):
20     if d.getVar('USING_WIC'):
21         fstypes = d.getVar('IMAGE_FSTYPES').split()
22         basetypes = set()
23         for fs in fstypes:
24             # Add the basetype to our set of basetypes in use
25             t = fs.split('.')[0]
26             if t != "wic":
27                 basetypes.add(t)
28         return ' '.join(basetypes)
29     else:
30         return ''
31
32 IMAGE_TYPEDEP:wic += "${@get_workaround_wic_typedeps(d)}"