feat(coreos-sanity): add some checks to ensure that coreos policies are not overwritted
This commit is contained in:
parent
a6f33081eb
commit
0b9a7d9c7e
|
|
@ -1,4 +1,6 @@
|
|||
build/
|
||||
vscode-bitbake-build/
|
||||
documentation/_build/
|
||||
documentation/oe-logs
|
||||
documentation/oe-workdir
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,26 @@ The ``coreos_metadata_scm`` is automatically inherited if ``DISTRO`` is set to
|
|||
``belden-coreos`` or to any distro based on ``belden-coreos``.
|
||||
|
||||
.. _ref-classes-coreos-image:
|
||||
.. index:: coreos_image.bbclass
|
||||
.. index:: coreos-image.bbclass
|
||||
|
||||
``coreos_image.bbclass``
|
||||
``coreos-image.bbclass``
|
||||
========================
|
||||
|
||||
The ``coreos-image`` class provides common definitions for the
|
||||
``coreos-image-*`` image recipes, such as support for additional
|
||||
:extern:ref:`IMAGE_FEATURE <ref-features-image>`.
|
||||
|
||||
.. _ref-classes-coreos-sanity:
|
||||
.. index:: coreos-sanity.class
|
||||
|
||||
``coreos-sanity.bbclass``
|
||||
========================
|
||||
|
||||
The ``coreos-sanity`` class is inherited inside the CoreOS layer
|
||||
configuration file to add some sanity checks. Theses check ensure that the
|
||||
policies of CoreOS are followed.
|
||||
|
||||
Currently, this add check to ensure:
|
||||
- that the distro is based on CoreOS
|
||||
- that SystemD is used as ``INIT_MANAGER``
|
||||
- that glibc is used as the default C library
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
# This class add some sanity checks to ensure that distribution based on
|
||||
# CoreOS only use the subset of openembedded-core that is supported by the
|
||||
# CoreOS team.
|
||||
|
||||
|
||||
SANITY_COREOS_COMPATIBLE ??= "0"
|
||||
|
||||
addhandler check_coreos_sanity_eventhandler
|
||||
check_coreos_sanity_eventhandler[eventmask] = "bb.event.SanityCheck"
|
||||
python check_coreos_sanity_eventhandler() {
|
||||
|
||||
if e.data.getVar('SANITY_COREOS_COMPATIBLE') != "1":
|
||||
bb.fatal(
|
||||
"The CoreOS layer is only compatible with distribution based on "
|
||||
"conf/distro/belden-core.conf.\n"
|
||||
"Please ensure that your distribution configuration file contains "
|
||||
" `require conf/distro/belden-core.conf`"
|
||||
)
|
||||
|
||||
if e.data.getVar('VIRTUAL-RUNTIME_init_manager') != "systemd":
|
||||
bb.fatal(
|
||||
"systemd is not set as `INIT_MANAGER`. "
|
||||
"Using SystemD is mandatory on CoreOS based distribution"
|
||||
)
|
||||
|
||||
if e.data.getVar("TCLIBC") != "glibc":
|
||||
bb.fatal(
|
||||
"glibc is not set as `TCLIBC`. "
|
||||
"Using glibc is mandatory on CoreOS based distribution"
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
|
@ -31,6 +31,10 @@ SANITY_TESTED_DISTROS ?= " \
|
|||
debian-11 \n \
|
||||
"
|
||||
|
||||
# This variable is used to ensure that any distribution using the CoreOS layer
|
||||
# include this file. This is checked by the coreos-sanity class
|
||||
SANITY_COREOS_COMPATIBLE ?= "1"
|
||||
|
||||
require conf/distro/include/no-static-libs.inc
|
||||
require conf/distro/include/yocto-uninative.inc
|
||||
require conf/distro/include/security_flags.inc
|
||||
|
|
|
|||
|
|
@ -11,3 +11,8 @@ BBFILE_PRIORITY_meta-belden-coreos = "6"
|
|||
|
||||
LAYERDEPENDS_meta-belden-coreos = "core"
|
||||
LAYERSERIES_COMPAT_meta-belden-coreos = "kirkstone"
|
||||
|
||||
# Sanity Checks
|
||||
# ==============================================================================
|
||||
|
||||
INHERIT += "coreos-sanity"
|
||||
|
|
|
|||
Loading…
Reference in New Issue