[meta-oe,RFC,2/2] insane: make patch upstream-status configurable

Message ID AM9PR09MB4642D4A55B08C53CADDD8104A8769@AM9PR09MB4642.eurprd09.prod.outlook.com
State New
Headers show
Series [meta-oe,RFC,1/2] oe.lib.recipeutils: add get_layer_name method | expand

Commit Message

Konrad Weihmann Dec. 15, 2021, 10:03 a.m. UTC
instead of hard coding /meta/ into a skip condition introduce a
variable called QA_PATCH_CHECK_LAYER containing a space
separated list of layer names to perform the upstrem-status check
against.

as this will add BBFILE_PATTERN_* and therefore host specific paths
to the task hash, we need to exclude do_qa_patch function from
task hashing.
As it is a postfunc it should run anyway, once do_patch needs to rerun

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
---
 meta/classes/insane.bbclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 240f3aad62..c19cc6f629 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -65,6 +65,8 @@  QA_EMPTY_DIRS ?= " \
 # message if the directory is not empty. If it is not specified for a directory,
 # then "but it is expected to be empty" will be used.
 
+QA_PATCH_CHECK_LAYER ?= "core"
+
 def package_qa_clean_path(path, d, pkg=None):
     """
     Remove redundant paths from the path for display.  If pkg isn't set then
@@ -1171,12 +1173,15 @@  python do_qa_patch() {
     # Check if the patch contains a correctly formatted and spelled Upstream-Status
     import re
     from oe import patch
+    from oe.recipeutils import get_layer_name
+
+    check_layer = (d.getVar("QA_PATCH_CHECK_LAYER") or "").split()
 
     for url in patch.src_patches(d):
        (_, _, fullpath, _, _, _) = bb.fetch.decodeurl(url)
 
-       # skip patches not in oe-core
-       if '/meta/' not in fullpath:
+       # skip patches in all but the configured ones
+       if get_layer_name(fullpath, d) not in check_layer:
            continue
 
        content = open(fullpath, encoding='utf-8', errors='ignore').read()
@@ -1298,6 +1303,7 @@  do_populate_sysroot[postfuncs] += "do_qa_staging "
 
 # Check for patch fuzz
 do_patch[postfuncs] += "do_qa_patch "
+do_patch[vardepsexclude] += "do_qa_patch "
 
 # Check broken config.log files, for packages requiring Gettext which
 # don't have it in DEPENDS.