[meta-virtualization] [meta-openstack][PATCH 1/3] sanity-meta-openstack.bbclass: add class for bbappend files checking

mingli.yu at windriver.com mingli.yu at windriver.com
Wed Oct 10 20:50:17 PDT 2018


From: Mingli Yu <Mingli.Yu at windriver.com>

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

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

Signed-off-by: Mingli Yu <Mingli.Yu at windriver.com>
---
 meta-openstack/README                                | 19 +++++++++++++++++++
 meta-openstack/classes/sanity-meta-openstack.bbclass | 10 ++++++++++
 meta-openstack/conf/layer.conf                       |  4 ++++
 3 files changed, 33 insertions(+)
 create mode 100644 meta-openstack/classes/sanity-meta-openstack.bbclass

diff --git a/meta-openstack/README b/meta-openstack/README
index 81b843b..8506250 100644
--- a/meta-openstack/README
+++ b/meta-openstack/README
@@ -5,6 +5,25 @@ This layer provides support for building the packages from the OpenStack project
 The layer contains recipes for the nova, glance, keystone, cinder, quantum, swift
 and horizon components.
 
+The bbappend files for some recipes (e.g. postgresql) and preferred version setting
+(e.g. python-networkx)in this layer need to have 'openstack' in DISTRO_FEATURES to
+have effect. To enable them, add in configuration file the following line.
+
+  DISTRO_FEATURES_append = " openstack"
+
+If meta-openstack is included, but openstack is not enabled as a
+distro feature a warning is printed at parse time:
+
+    You have included the meta-openstack layer, but
+    'openstack' has not been enabled in your DISTRO_FEATURES. Some bbappend files
+    and preferred version setting may not take effect. See the meta-openstack README
+    for details on enabling openstack support.
+
+If you know what you are doing, this warning can be disabled by setting the following
+variable in your configuration:
+
+  SKIP_META_OPENSTACK_SANITY_CHECK = 1
+
 Dependencies
 ------------
 
diff --git a/meta-openstack/classes/sanity-meta-openstack.bbclass b/meta-openstack/classes/sanity-meta-openstack.bbclass
new file mode 100644
index 0000000..3d5e57b
--- /dev/null
+++ b/meta-openstack/classes/sanity-meta-openstack.bbclass
@@ -0,0 +1,10 @@
+addhandler openstack_bbappend_distrocheck
+openstack_bbappend_distrocheck[eventmask] = "bb.event.SanityCheck"
+python openstack_bbappend_distrocheck() {
+    skip_check = e.data.getVar('SKIP_META_OPENSTACK_SANITY_CHECK') == "1"
+    if 'openstack' not in e.data.getVar('DISTRO_FEATURES').split() and not skip_check:
+        bb.warn("You have included the meta-openstack layer, but \
+'openstack' has not been enabled in your DISTRO_FEATURES. Some bbappend files \
+and preferred version setting may not take effect. See the meta-openstack README \
+for details on enabling openstack support.")
+}
diff --git a/meta-openstack/conf/layer.conf b/meta-openstack/conf/layer.conf
index 126f37f..f322bcd 100644
--- a/meta-openstack/conf/layer.conf
+++ b/meta-openstack/conf/layer.conf
@@ -35,5 +35,9 @@ PREFERRED_VERSION_python-jsonschema = "2.6.0"
 PREFERRED_VERSION_python-networkx = "1.11"
 PREFERRED_VERSION_python-oslo.i18n = "3.17.0+gitAUTOINC+f2729cd36f"
 
+# Sanity check for meta-openstack layer.
+# Setting SKIP_META_OPENSTACK_SANITY_CHECK to "1" would skip the bbappend files check.
+INHERIT += "sanity-meta-openstack"
+
 LICENSE_PATH += "${LAYERDIR}/licenses"
 LAYERRECOMMENDS_openstack-layer = "meta-openstack-dl (= 2.6)"
-- 
2.7.4



More information about the meta-virtualization mailing list