diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2017-03-30 21:30:28 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-05 12:36:44 +0100 |
commit | 6e0a268b750fb6701604dd936cd2cf3b47a6e804 (patch) | |
tree | 0dd91fe6ed743bc91820567c0f5850ca135e2ee5 /scripts | |
parent | 57fc8a9771174b7d0533a42c045053adefa537a8 (diff) | |
download | openembedded-core-6e0a268b750fb6701604dd936cd2cf3b47a6e804.tar.gz openembedded-core-6e0a268b750fb6701604dd936cd2cf3b47a6e804.tar.bz2 openembedded-core-6e0a268b750fb6701604dd936cd2cf3b47a6e804.zip |
compatlayer/__init__.py: Allow add_layer to process recursive deps
When processing a layer for dependencies, you have to process the layer
itself, it's dependencies, the dependencies dependencies and so forth until
all items have been processed.
i.e.: LayerA requires LayerB requires LayerC requires layerD
The end result should be LayerB, LayerC and LayerD are all dependencies of
LayerA.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/compatlayer/__init__.py | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py index 087ac14148..8d8bdfe939 100644 --- a/scripts/lib/compatlayer/__init__.py +++ b/scripts/lib/compatlayer/__init__.py @@ -143,10 +143,9 @@ def _find_layer_depends(depend, layers): def add_layer(bblayersconf, layer, layers, logger): logger.info('Adding layer %s' % layer['name']) - for collection in layer['collections']: - depends = layer['collections'][collection]['depends'] - if not depends: - continue + def recurse_dependencies(depends, layer, layers, logger, ret = []): + logger.debug('Processing dependencies %s for layer %s.' % \ + (depends, layer['name'])) for depend in depends.split(): # core (oe-core) is suppose to be provided @@ -157,8 +156,39 @@ def add_layer(bblayersconf, layer, layers, logger): if not layer_depend: logger.error('Layer %s depends on %s and isn\'t found.' % \ (layer['name'], depend)) - return False + ret = None + continue + + # We keep processing, even if ret is None, this allows us to report + # multiple errors at once + if ret is not None and layer_depend not in ret: + ret.append(layer_depend) + + # Recursively process... + if 'collections' not in layer_depend: + continue + + for collection in layer_depend['collections']: + collect_deps = layer_depend['collections'][collection]['depends'] + if not collect_deps: + continue + ret = recurse_dependencies(collect_deps, layer_depend, layers, logger, ret) + + return ret + layer_depends = [] + for collection in layer['collections']: + depends = layer['collections'][collection]['depends'] + if not depends: + continue + + layer_depends = recurse_dependencies(depends, layer, layers, logger, layer_depends) + + # Note: [] (empty) is allowed, None is not! + if layer_depends is None: + return False + else: + for layer_depend in layer_depends: logger.info('Adding layer dependency %s' % layer_depend['name']) with open(bblayersconf, 'a+') as f: f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) |