From fd7d7bf76a3884ef1e7a3556a66e8c157a40fca2 Mon Sep 17 00:00:00 2001 From: Pavel Zhukov <pavel.zhukov@huawei.com> Date: Mon, 4 Apr 2022 14:06:40 +0200 Subject: [PATCH] Add layer to keep supportability tools and metadata Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com> --- .../classes/supportability.bbclass | 36 +++++++++++++++++++ meta-oniro-support/conf/layer.conf | 20 +++++++++++ .../recipes-connectivity/bind/bind.support | 4 +++ .../recipes-connectivity/bind/bind_%.bbappend | 4 +++ 4 files changed, 64 insertions(+) create mode 100644 meta-oniro-support/classes/supportability.bbclass create mode 100644 meta-oniro-support/conf/layer.conf create mode 100644 meta-oniro-support/recipes-connectivity/bind/bind.support create mode 100644 meta-oniro-support/recipes-connectivity/bind/bind_%.bbappend diff --git a/meta-oniro-support/classes/supportability.bbclass b/meta-oniro-support/classes/supportability.bbclass new file mode 100644 index 0000000..9a30a22 --- /dev/null +++ b/meta-oniro-support/classes/supportability.bbclass @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# This class provides a mechanism to analize image and provide developers with +# "supportability" status of the project + +SUPPORT_LOG_DIR ?= "${LOG_DIR}/supportability/" +SUPPORT_LOG_FILE ?= "${SUPPORT_LOG_DIR}/supportability.txt" +SUPPORT_EXCLUDE_LAYERS ?= "" + +addtask supportability_report before do_fetch + +python do_supportability_report () { + support = d.getVar("SUPPORT_LEVEL") or "0" + pn = d.getVar("PN" or "%unknown%") + if d.getVar("SUPPORT_SILENT") != "1": + if support.strip() == "Unsupported": + bb.error("The \"{pn}\" package is unsupported by Oniro Project." \ + "Please check your image dependencies and consider replacement {pn} with an alternative".format(pn=pn)) +} + +def support_status(): + ret = "" + ret += "{}\n".format(d.getVar("SUPPORT_LEVEL") or "0") + return ret + +python do_generate_report () { + deploy_file = d.getVar("SUPPORT_LOG_DIR") + bb.utils.mkdirhier(os.path.dirname(deploy_file)) + with open(REPORTFILE, 'a') as reportfile: + bb.warn("Writing file: {}".format(reportfile)) + reportfile.write(support_status) +} + +do_fetch[prefunc] += "do_generate_report" diff --git a/meta-oniro-support/conf/layer.conf b/meta-oniro-support/conf/layer.conf new file mode 100644 index 0000000..305087d --- /dev/null +++ b/meta-oniro-support/conf/layer.conf @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "oniro-supportability" +BBFILE_PATTERN_oniro-supportability = "^${LAYERDIR}/" +BBFILE_PRIORITY_oniro-supportability = "8" + +LAYERDEPENDS_oniro-supportability = " \ + core \ + " +LAYERSERIES_COMPAT_oniro-supportability = "kirkstone" + diff --git a/meta-oniro-support/recipes-connectivity/bind/bind.support b/meta-oniro-support/recipes-connectivity/bind/bind.support new file mode 100644 index 0000000..c5a52f7 --- /dev/null +++ b/meta-oniro-support/recipes-connectivity/bind/bind.support @@ -0,0 +1,4 @@ +SUPPORT_META_VERSION="1" +SUPPORT_EOL="0" +SUPPORT_LEVEL="Unsupported" +SUPPORT_REASON="High supportability cost. Not suitable for IoT devices" \ No newline at end of file diff --git a/meta-oniro-support/recipes-connectivity/bind/bind_%.bbappend b/meta-oniro-support/recipes-connectivity/bind/bind_%.bbappend new file mode 100644 index 0000000..c5a52f7 --- /dev/null +++ b/meta-oniro-support/recipes-connectivity/bind/bind_%.bbappend @@ -0,0 +1,4 @@ +SUPPORT_META_VERSION="1" +SUPPORT_EOL="0" +SUPPORT_LEVEL="Unsupported" +SUPPORT_REASON="High supportability cost. Not suitable for IoT devices" \ No newline at end of file -- GitLab