scripts/lib/compatlayer: Remove require of meta- in layer dir name
PATCH 1/3 scripts/lib/compatlayer: Remove require of meta- in layer dir name
The layers isn't required to have a dirctory name start with meta- so remove the validation.
Signed-off-by Aníbal Limón <[email protected]>
--- scripts/lib/compatlayer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/compatlayer/__init__.py +1 -1
@@ -118,7 +118,7 @@ def detect_layers(layer_directories): for root, dirs, files in os.walk(directory): dir_name = os.path.basename(root) conf_dir = os.path.join(root, 'conf') - if dir_name.startswith('meta-') and os.path.isdir(conf_dir): + if os.path.isdir(conf_dir): layer = _detect_layer(root) if layer: layers.append(layer)
Signature · 1 line
2.1.4
PATCH 2/3 scripts/yocto-compat-layer.py: Add option to disable layer autodiscovery
Sometimes there is a need to only analyze the layer specified by the command line, the new option -n will disable autodiscovery of layers and only will try to test specified layers.
Signed-off-by Aníbal Limón <[email protected]>
--- scripts/lib/compatlayer/__init__.py | 17 ++++++++++++----- scripts/yocto-compat-layer.py | 4 +++- 2 files changed, 15 insertions(+), 6 deletions(-)
scripts/lib/compatlayer/__init__.py +12 -5
@@ -108,20 +108,27 @@ def _detect_layer(layer_path): return layer -def detect_layers(layer_directories): +def detect_layers(layer_directories, no_auto): layers = [] for directory in layer_directories: if directory[-1] == '/': directory = directory[0:-1] - for root, dirs, files in os.walk(directory): - dir_name = os.path.basename(root) - conf_dir = os.path.join(root, 'conf') + if no_auto: + conf_dir = os.path.join(directory, 'conf') if os.path.isdir(conf_dir): - layer = _detect_layer(root) + layer = _detect_layer(directory) if layer: layers.append(layer) + else: + for root, dirs, files in os.walk(directory): + dir_name = os.path.basename(root) + conf_dir = os.path.join(root, 'conf') + if os.path.isdir(conf_dir): + layer = _detect_layer(root) + if layer: + layers.append(layer) return layers
scripts/yocto-compat-layer.py +3 -1
@@ -47,6 +47,8 @@ def main(): help='Layer to test compatibility with Yocto Project') parser.add_argument('-o', '--output-log', help='File to output log (optional)', action='store') + parser.add_argument('-n', '--no-auto', help='Disable auto layer discovery', + action='store_true') parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') parser.add_argument('-q', '--quiet', help='Print only errors',
@@ -74,7 +76,7 @@ def main(): builddir = os.environ['BUILDDIR'] bblayersconf = os.path.join(builddir, 'conf', 'bblayers.conf') - layers = detect_layers(args.layers) + layers = detect_layers(args.layers, args.no_auto) if not layers: logger.error("Fail to detect layers") return 1
Signature · 1 line
2.1.4
PATCH 3/3 scripts/yocto-compat-layer.py: Handle layer dependencies when test
In reply to Aníbal LimónIf some layer depends on other tries to find layer dependency, if the layer dependency isn't found avoid to test the layer and notice the user.
Signed-off-by Aníbal Limón <[email protected]>
--- scripts/lib/compatlayer/__init__.py | 29 ++++++++++++++++++++++++++++- scripts/yocto-compat-layer.py | 21 +++++++++++++-------- 2 files changed, 41 insertions(+), 9 deletions(-)
scripts/lib/compatlayer/__init__.py +28 -1
@@ -132,10 +132,37 @@ def detect_layers(layer_directories, no_auto): return layers -def add_layer(bblayersconf, layer): +def _find_layer_depends(depend, layers): + for layer in layers: + for collection in layer['collections']: + if depend == collection: + return layer + return None + +def add_layer(bblayersconf, layer, layers, logger): + logger.info('Adding layer %s' % layer['name']) + + for collection in layer['collections']: + for depend in layer['collections'][collection]['depends'].split(): + # core (oe-core) is suppose to be provided + if depend == 'core': + continue + + layer_depend = _find_layer_depends(depend, layers) + if not layer_depend: + logger.error('Layer %s depends on %s and isn\'t found.' % \ + (layer['name'], depend)) + return False + + logger.info('Adding layer dependency %s' % layer_depend['name']) + with open(bblayersconf, 'a+') as f: + f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) + with open(bblayersconf, 'a+') as f: f.write("\nBBLAYERS += \"%s\"\n" % layer['path']) + return True + def get_signatures(builddir, failsafe=False): import subprocess import re
scripts/yocto-compat-layer.py +13 -8
@@ -116,6 +116,7 @@ def main(): td['sigs'] = get_signatures(td['builddir']) logger.info('') + layers_tested = 0 for layer in layers: if layer['type'] == LayerType.ERROR_NO_LAYER_CONF or \ layer['type'] == LayerType.ERROR_BSP_DISTRO:
@@ -123,16 +124,20 @@ def main(): shutil.copyfile(bblayersconf + '.backup', bblayersconf) - add_layer(bblayersconf, layer) + if not add_layer(bblayersconf, layer, layers, logger): + continue + result = test_layer_compatibility(td, layer) results[layer['name']] = result - - logger.info('') - logger.info('Summary of results:') - logger.info('') - for layer_name in results: - logger.info('%s ... %s' % (layer_name, 'PASS' if \ - results[layer_name].wasSuccessful() else 'FAIL')) + layers_tested = layers_tested + 1 + + if layers_tested: + logger.info('') + logger.info('Summary of results:') + logger.info('') + for layer_name in results: + logger.info('%s ... %s' % (layer_name, 'PASS' if \ + results[layer_name].wasSuccessful() else 'FAIL')) cleanup_bblayers(None, None)
Signature · 1 line
2.1.4