Message ID | 20221128081645.3010581-1-mingli.yu@eng.windriver.com |
---|---|
State | New |
Headers | show |
Series | yocto-check-layer: add option to skip sublayer | expand |
On Mon, 2022-11-28 at 16:16 +0800, Yu, Mingli wrote: > From: Mingli Yu <mingli.yu@windriver.com> > > 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 > > Signed-off-by: Mingli Yu <mingli.yu@windriver.com> > --- > 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
diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py index aa946f3036..07bc7f3e3c 100644 --- a/scripts/lib/checklayer/__init__.py +++ b/scripts/lib/checklayer/__init__.py @@ -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): diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer index 0e5b75b1f7..6a8f23e8f8 100755 --- a/scripts/yocto-check-layer +++ b/scripts/yocto-check-layer @@ -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