From: Mingli Yu <[email protected]>

We can define the layers need to check in a file and skip the yocto
compliance check if the layer is't defined in the file.

Signed-off-by: Mingli Yu <[email protected]>
---
 scripts/yocto-check-layer | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer
index 67cc71950f..e75f89f224 100755
--- a/scripts/yocto-check-layer
+++ b/scripts/yocto-check-layer
@@ -47,6 +47,28 @@ def dump_layer_debug(layer):
     if collections:
         logger.debug("%s collections: %s" % (layer["name"], ", 
".join(collections)))
 
+def skip_layer(layer, config=""):
+    """
+    The config define a file used to define the layers we need to check.
+    And the content looks like as below for example:
+    RECIPE_LIST_LAYERS = 'openembedded-layer chromium-browser-layer 
clang-layer'
+    The return value True indicates we need to skip the layer
+    """
+    if config and os.path.exists(config):
+        logger.debug("Reading RECIPE_LIST_LAYERS from %s" % 
os.path.realpath(config))
+        layerlists = []
+        collections = layer.get("collections", {})
+        if collections:
+            collections = " ".join(collections)
+            logger.debug("layername: %s, collections: %s" % (layer["name"], 
collections))
+            with open(config, 'r') as f:
+                for line in f:
+                    if line.startswith("RECIPE_LIST_LAYERS"):
+                        layerlists = line.replace("'", '').replace('"', 
'').split()[2:]
+            if layerlists:
+                return not (collections in layerlists)
+    return False
+
 def main():
     parser = argparse.ArgumentParser(
             description="Yocto Project layer checking tool",
@@ -57,6 +79,8 @@ def main():
             help='File to output log (optional)', action='store')
     parser.add_argument('--dependency', nargs="+",
             help='Layers to process for dependencies', action='store')
+    parser.add_argument("--recipe-list-layers",
+            help='Read RECIPE_LIST_LAYERS from the file, the 
RECIPE_LIST_LAYERS must be in one line (optional)', action='store')
     parser.add_argument('--no-auto-dependency', help='Disable automatic 
testing of dependencies',
             action='store_true')
     parser.add_argument('--machines', nargs="+",
@@ -185,6 +209,12 @@ def main():
         logger.info("Setting up for %s(%s), %s" % (layer['name'], 
layer['type'],
             layer['path']))
 
+        if args.recipe_list_layers and skip_layer(layer, 
args.recipe_list_layers):
+
+            results[layer['name']] = None
+            results_status[layer['name']] = 'SKIPPED (Unsupported by 
RECIPE_LIST_LAYERS)'
+            layers_tested = layers_tested + 1
+            continue
         missing_dependencies = not add_layer_dependencies(bblayersconf, layer, 
dep_layers, logger)
         if not missing_dependencies:
             for additional_layer in additional_layers:
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#174488): 
https://lists.openembedded.org/g/openembedded-core/message/174488
Mute This Topic: https://lists.openembedded.org/mt/95617459/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to