From f64a94204a3031a41500c32bacbf80f29ca99ef0 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Thu, 18 Aug 2022 14:26:28 +0200
Subject: [PATCH] Align
 ONIRO_LAYERS_CONF_VERSION/ONIRO_REQUIRED_LAYERS_CONF_VERSION

We define the initial value for these variables as being 1. We also need
to set a default value for ONIRO_LAYERS_CONF_VERSION because the check
will not be triggered when ONIRO_LAYERS_CONF_VERSION is not defined
(builds before this check is introduced).

Finally, we drop POKY_BBLAYERS_CONF_VERSION as it is  an artefact from
when the project was using the poky distro.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 flavours/linux/bblayers.conf.sample           |  7 ++++---
 meta-oniro-core/conf/distro/include/oniro.inc | 10 ++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/flavours/linux/bblayers.conf.sample b/flavours/linux/bblayers.conf.sample
index 42ec1269..d8540b01 100644
--- a/flavours/linux/bblayers.conf.sample
+++ b/flavours/linux/bblayers.conf.sample
@@ -2,9 +2,10 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
-# changes incompatibly
-POKY_BBLAYERS_CONF_VERSION = "2"
+# Bump this each time bblayers.conf.sample changes incompatibly. For example,
+# when integrating new layers. It needs to be in sync with
+# ONIRO_REQUIRED_LAYERS_CONF_VERSION for associated sanity check to pass.
+ONIRO_LAYERS_CONF_VERSION = "1"
 
 BBPATH = "${TOPDIR}"
 BBFILES ?= ""
diff --git a/meta-oniro-core/conf/distro/include/oniro.inc b/meta-oniro-core/conf/distro/include/oniro.inc
index 66c8074c..0b78537e 100644
--- a/meta-oniro-core/conf/distro/include/oniro.inc
+++ b/meta-oniro-core/conf/distro/include/oniro.inc
@@ -15,3 +15,13 @@ PREFERRED_PROVIDER_virtual/java-initial-native ?= "cacao-initial-native"
 PREFERRED_PROVIDER_virtual/java-native ?= "cacao-native"
 
 BB_DANGLINGAPPENDS_WARNONLY:forcevariable = "0"
+
+# Bump this each time bblayers.conf.sample changes incompatibly. For example,
+# when integrating new layers.
+ONIRO_REQUIRED_LAYERS_CONF_VERSION = "1"
+# oe-core's sanity check sanity_check_conffiles function only runs the
+# functions in BBLAYERS_CONF_UPDATE_FUNCS when the associated variable is not
+# None. Making sure this variable has a default value, we force running the
+# check even when ONIRO_LAYERS_CONF_VERSION is not defined - providing the
+# relevant error message.
+ONIRO_LAYERS_CONF_VERSION ??= "-1"
-- 
GitLab