Skip to contentSkip to conversation

yocto-check-layer: add option to skip sublayer

PATCH In review [email protected] 2 participants 2 messages Nov 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 yocto-check-layer: add option to skip sublayer

From: Mingli Yu <[email protected]>

When do yocto compliance for a layer which contains many sublayers, we may just want to check the top-level layer, so add one option to achieve this.

Before the patch:

  $ yocto-check-layer-wrapper ../layers/meta-cloud-services  --dependency ../layers/meta-openembedded ../layers/meta-virtualization --no-auto-dependency
  [snip]
  INFO: meta-cloud-services ... PASS
  INFO: meta-openstack-controller-deploy ... PASS
  INFO: meta-openstack-aio-deploy ... PASS
  INFO: meta-openstack-compute-test-config ... PASS
  INFO: meta-openstack-controller-test-config ... PASS
  INFO: meta-openstack-compute-deploy ... PASS
  INFO: meta-openstack-swift-deploy ... PASS
  INFO: meta-openstack ... PASS
  INFO: meta-openstack-qemu ... PASS

After the patch:

 $ yocto-check-layer-wrapper ../layers/meta-cloud-services  --dependency ../layers/meta-openembedded ../layers/meta-virtualization --no-auto-dependency --no-sub
  [snip]
  INFO: meta-cloud-services ... PASS
---
 scripts/lib/checklayer/__init__.py | 9 ++++++++-
 scripts/yocto-check-layer          | 4 +++-
 2 files changed, 11 insertions(+), 2 deletions(-)
scripts/lib/checklayer/__init__.py +8 -1
index aa946f3036..07bc7f3e3c 100644
@@ -121,7 +121,7 @@ def _detect_layer(layer_path):
 
     return layer
 
-def detect_layers(layer_directories, no_auto):
+def detect_layers(layer_directories, no_auto, no_sub=0):
     layers = []
 
     for directory in layer_directories:
@@ -129,6 +129,13 @@ def detect_layers(layer_directories, no_auto):
         if directory[-1] == '/':
             directory = directory[0:-1]
 
+        if no_sub:
+            conf_dir = os.path.join(directory, 'conf')
+            if os.path.isdir(conf_dir):
+                layer = _detect_layer(directory)
+                if layer:
+                    layers.append(layer)
+                    continue
         if no_auto:
             conf_dir = os.path.join(directory, 'conf')
             if os.path.isdir(conf_dir):
scripts/yocto-check-layer +3 -1
index 0e5b75b1f7..6a8f23e8f8 100755
@@ -71,6 +71,8 @@ def main():
                        help='disable signature checking for software layers')
     parser.add_argument('-n', '--no-auto', help='Disable auto layer discovery',
             action='store_true')
+    parser.add_argument('-s', '--no-sub', help='Disable auto sublayer testing',
+            action='store_true')
     parser.add_argument('-d', '--debug', help='Enable debug output',
             action='store_true')
     parser.add_argument('-q', '--quiet', help='Print only errors',
@@ -98,7 +100,7 @@ def main():
     builddir = os.environ['BUILDDIR']
     bblayersconf = os.path.join(builddir, 'conf', 'bblayers.conf')
 
-    layers = detect_layers(args.layers, args.no_auto)
+    layers = detect_layers(args.layers, args.no_auto, args.no_sub)
     if not layers:
         logger.error("Failed to detect layers")
         return 1
Signature · 1 line
2.25.1
#1 lore raw
Quoted 24 lines · Mingli

From: Mingli Yu <[email protected]>

When do yocto compliance for a layer which contains many sublayers, we may just want to check the top-level layer, so add one option to achieve this.

Before the patch:

  $ yocto-check-layer-wrapper ../layers/meta-cloud-services  --dependency ../layers/meta-openembedded ../layers/meta-virtualization --no-auto-dependency
  [snip]
  INFO: meta-cloud-services ... PASS
  INFO: meta-openstack-controller-deploy ... PASS
  INFO: meta-openstack-aio-deploy ... PASS
  INFO: meta-openstack-compute-test-config ... PASS
  INFO: meta-openstack-controller-test-config ... PASS
  INFO: meta-openstack-compute-deploy ... PASS
  INFO: meta-openstack-swift-deploy ... PASS
  INFO: meta-openstack ... PASS
  INFO: meta-openstack-qemu ... PASS

After the patch:

 $ yocto-check-layer-wrapper ../layers/meta-cloud-services  --dependency ../layers/meta-openembedded ../layers/meta-virtualization --no-auto-dependency --no-sub
  [snip]
  INFO: meta-cloud-services ... PASS
Quoted 5 lines
---
 scripts/lib/checklayer/__init__.py | 9 ++++++++-
 scripts/yocto-check-layer          | 4 +++-
 2 files changed, 11 insertions(+), 2 deletions(-)

I'm not sure this is a good idea as it may lead to people claiming a layer is compatible when a sublayer within that isn't?

Cheers,

Richard