sanity-meta-virt.bbclass: add class for bbappend files checking

Add a new class, sanity-meta-virt.bbclass, to check for whether necessary
settings are available for bbappend files in this layer to be effective,
and warn users if not.

In addition, a variable SKIP_SANITY_BBAPPEND_CHECK is added to enable users
to explicitly skip the checking to avoid unwanted warnings.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
Chen Qi 2017-09-30 11:06:15 +08:00 committed by Bruce Ashfield
parent b7febd5592
commit bfba140b83
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,10 @@
addhandler virt_bbappend_distrocheck
virt_bbappend_distrocheck[eventmask] = "bb.event.ConfigParsed"
python virt_bbappend_distrocheck() {
skip_check = e.data.getVar('SKIP_SANITY_BBAPPEND_CHECK') == "1"
if 'virtualization' not in e.data.getVar('DISTRO_FEATURES').split() and not skip_check:
bb.warn("You have included the meta-virtualization layer, but \
'virtualization' has not been enabled in your DISTRO_FEATURES. Some bbappend files \
may not take effect. See the meta-virtualization README for details on enabling \
virtualization support.")
}

View File

@ -22,3 +22,7 @@ require conf/distro/include/virt_security_flags.inc
PREFERRED_PROVIDER_virtual/runc ?= "runc-docker"
PREFERRED_PROVIDER_virtual/containerd ?= "containerd-docker"
# Sanity check for meta-virtualization layer.
# Setting SKIP_SANITY_BBAPPEND_CHECK to "1" would skip the bbappend files check.
INHERIT += "sanity-meta-virt"