Skip to content
Snippets Groups Projects
Verified Commit 0738ecd3 authored by Andrei Gherzan's avatar Andrei Gherzan :penguin:
Browse files

oniro-sanity.bbclass: Check for bblayers.conf.samples incompatibility


The logic is similar to how oe-core and poky handle their set of sample
configurations. The core difference is the fact that we only flag
currently (no automatic migrations yet) by providing a helpful build
error before parsing. In this way we can instruct an user to update
their bblayers.conf when the Oniro introduced new lateyers integrations.

The variables of interest here are ONIRO_LAYERS_CONF_VERSION and
ONIRO_REQUIRED_LAYERS_CONF_VERSION. Whenever the project's
bblayers.conf.sample changes, we need to bump both of these values.

Signed-off-by: Andrei Gherzan's avatarAndrei Gherzan <andrei.gherzan@huawei.com>
parent 8a4d1213
No related branches found
No related tags found
No related merge requests found
...@@ -72,3 +72,54 @@ python oniro_sanity_handler() { ...@@ -72,3 +72,54 @@ python oniro_sanity_handler() {
addhandler oniro_sanity_handler addhandler oniro_sanity_handler
oniro_sanity_handler[eventmask] = "bb.event.BuildStarted" oniro_sanity_handler[eventmask] = "bb.event.BuildStarted"
#
# Build configuration checks and migrations
#
# Ensure our function runs after the OE-Core's one.
BBLAYERS_CONF_UPDATE_FUNCS += "conf/bblayers.conf:ONIRO_LAYERS_CONF_VERSION:ONIRO_REQUIRED_LAYERS_CONF_VERSION:oniro_update_bblayersconf"
# All flavours take advanatge of the same bblayers.conf.sample file. The linux
# one is the actual file while all the others are symlinks to it.
ONIRO_LAYERS_CONF_SAMPLE = "${ONIRO_COREBASE}/flavours/${ONIRO_FLAVOUR}/bblayers.conf.sample"
python oniro_update_bblayersconf() {
version = int(d.getVar('ONIRO_LAYERS_CONF_VERSION', True) or -1)
required_version = int(d.getVar('ONIRO_REQUIRED_LAYERS_CONF_VERSION', True) or -1)
upgrade_fail_msg = """You need to update the build's bblayers.conf manually for this version transition.
Compare your build\'s bblayers.conf with the Oniro\'s bblayers.conf.sample and merge
any changes before continuing. You can take advantage of a tool like "${SANITY_DIFF_TOOL}":
"${SANITY_DIFF_TOOL} conf/bblayers.conf ${ONIRO_LAYERS_CONF_SAMPLE}"
Note:
Once ONIRO_LAYERS_CONF_VERSION (currently ${ONIRO_LAYERS_CONF_VERSION}) value in conf/bblayers.conf matches the
ONIRO_REQUIRED_LAYERS_CONF_VERSION (currently ${ONIRO_REQUIRED_LAYERS_CONF_VERSION}) value in the Oniro build metadata,
this error will go away.
"""
upgrade_fail_msg = d.expand(upgrade_fail_msg)
downgrade_fail_msg = """Your build's bblayers.conf was generated from a newer build metadata.
Compare your build\'s bblayers.conf with the Oniro\'s bblayers.conf.sample and merge
any changes before continuing. You can take advantage of a tool like \"${SANITY_DIFF_TOOL}\":
${SANITY_DIFF_TOOL} conf/bblayers.conf ${ONIRO_LAYERS_CONF_SAMPLE}
Note:
Once ONIRO_LAYERS_CONF_VERSION (currently ${ONIRO_LAYERS_CONF_VERSION}) value in conf/bblayers.conf matches the
ONIRO_REQUIRED_LAYERS_CONF_VERSION (currently ${ONIRO_REQUIRED_LAYERS_CONF_VERSION}) value in the Oniro build metadata,
this error will go away.
"""
downgrade_fail_msg = d.expand(downgrade_fail_msg)
if version == -1 or required_version == -1:
bb.fatal(upgrade_fail_msg)
elif version < required_version:
bb.fatal(upgrade_fail_msg)
elif version > required_version:
bb.fatal(downgrade_fail_msg)
bb.fatal("You need to update bblayers.conf manually for this version transition.")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment