diff options
-rw-r--r-- | scripts/lib/compatlayer/__init__.py | 29 | ||||
-rwxr-xr-x | scripts/yocto-compat-layer.py | 21 |
2 files changed, 41 insertions, 9 deletions
diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py index b8ce771319..435679edbf 100644 --- a/scripts/lib/compatlayer/__init__.py +++ b/scripts/lib/compatlayer/__init__.py @@ -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 diff --git a/scripts/yocto-compat-layer.py b/scripts/yocto-compat-layer.py index b4de84a0a5..9e74033340 100755 --- a/scripts/yocto-compat-layer.py +++ b/scripts/yocto-compat-layer.py @@ -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) |