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 23:22:13 +0100 |
commit | d2d019a11b48a4537b8ef73c0175302728c807a0 (patch) | |
tree | 7d3b9291c2ba37ad7b9c6b873de82b301fdeaf4e /scripts | |
parent | efd07494c595fb67a3e3febfec9d7d638f9a41c8 (diff) | |
download | poky-d2d019a11b48a4537b8ef73c0175302728c807a0.tar.gz |
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.
(From OE-Core rev: 6e0a268b750fb6701604dd936cd2cf3b47a6e804)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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): | |||
143 | def add_layer(bblayersconf, layer, layers, logger): | 143 | def add_layer(bblayersconf, layer, layers, logger): |
144 | logger.info('Adding layer %s' % layer['name']) | 144 | logger.info('Adding layer %s' % layer['name']) |
145 | 145 | ||
146 | for collection in layer['collections']: | 146 | def recurse_dependencies(depends, layer, layers, logger, ret = []): |
147 | depends = layer['collections'][collection]['depends'] | 147 | logger.debug('Processing dependencies %s for layer %s.' % \ |
148 | if not depends: | 148 | (depends, layer['name'])) |
149 | continue | ||
150 | 149 | ||
151 | for depend in depends.split(): | 150 | for depend in depends.split(): |
152 | # core (oe-core) is suppose to be provided | 151 | # core (oe-core) is suppose to be provided |
@@ -157,8 +156,39 @@ def add_layer(bblayersconf, layer, layers, logger): | |||
157 | if not layer_depend: | 156 | if not layer_depend: |
158 | logger.error('Layer %s depends on %s and isn\'t found.' % \ | 157 | logger.error('Layer %s depends on %s and isn\'t found.' % \ |
159 | (layer['name'], depend)) | 158 | (layer['name'], depend)) |
160 | return False | 159 | ret = None |
160 | continue | ||
161 | |||
162 | # We keep processing, even if ret is None, this allows us to report | ||
163 | # multiple errors at once | ||
164 | if ret is not None and layer_depend not in ret: | ||
165 | ret.append(layer_depend) | ||
166 | |||
167 | # Recursively process... | ||
168 | if 'collections' not in layer_depend: | ||
169 | continue | ||
170 | |||
171 | for collection in layer_depend['collections']: | ||
172 | collect_deps = layer_depend['collections'][collection]['depends'] | ||
173 | if not collect_deps: | ||
174 | continue | ||
175 | ret = recurse_dependencies(collect_deps, layer_depend, layers, logger, ret) | ||
176 | |||
177 | return ret | ||
161 | 178 | ||
179 | layer_depends = [] | ||
180 | for collection in layer['collections']: | ||
181 | depends = layer['collections'][collection]['depends'] | ||
182 | if not depends: | ||
183 | continue | ||
184 | |||
185 | layer_depends = recurse_dependencies(depends, layer, layers, logger, layer_depends) | ||
186 | |||
187 | # Note: [] (empty) is allowed, None is not! | ||
188 | if layer_depends is None: | ||
189 | return False | ||
190 | else: | ||
191 | for layer_depend in layer_depends: | ||
162 | logger.info('Adding layer dependency %s' % layer_depend['name']) | 192 | logger.info('Adding layer dependency %s' % layer_depend['name']) |
163 | with open(bblayersconf, 'a+') as f: | 193 | with open(bblayersconf, 'a+') as f: |
164 | f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) | 194 | f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) |