diff options
Diffstat (limited to 'scripts/lib/checklayer/__init__.py')
-rw-r--r-- | scripts/lib/checklayer/__init__.py | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py index ca7863a19e..670f0eea39 100644 --- a/scripts/lib/checklayer/__init__.py +++ b/scripts/lib/checklayer/__init__.py | |||
@@ -196,31 +196,29 @@ def add_layer_dependencies(bblayersconf, layer, layers, logger): | |||
196 | if layer_depends is None: | 196 | if layer_depends is None: |
197 | return False | 197 | return False |
198 | else: | 198 | else: |
199 | # Don't add a layer that is already present. | 199 | add_layers(bblayersconf, layer_depends, logger) |
200 | added = set() | 200 | |
201 | output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8') | 201 | return True |
202 | for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE): | 202 | |
203 | added.add(path) | 203 | def add_layers(bblayersconf, layers, logger): |
204 | 204 | # Don't add a layer that is already present. | |
205 | for layer_depend in layer_depends: | 205 | added = set() |
206 | name = layer_depend['name'] | 206 | output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8') |
207 | path = layer_depend['path'] | 207 | for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE): |
208 | added.add(path) | ||
209 | |||
210 | with open(bblayersconf, 'a+') as f: | ||
211 | for layer in layers: | ||
212 | logger.info('Adding layer %s' % layer['name']) | ||
213 | name = layer['name'] | ||
214 | path = layer['path'] | ||
208 | if path in added: | 215 | if path in added: |
209 | continue | 216 | logger.info('%s is already in %s' % (name, bblayersconf)) |
210 | else: | 217 | else: |
211 | added.add(path) | 218 | added.add(path) |
212 | logger.info('Adding layer dependency %s' % name) | ||
213 | with open(bblayersconf, 'a+') as f: | ||
214 | f.write("\nBBLAYERS += \"%s\"\n" % path) | 219 | f.write("\nBBLAYERS += \"%s\"\n" % path) |
215 | return True | 220 | return True |
216 | 221 | ||
217 | def add_layer(bblayersconf, layer, layers, logger): | ||
218 | logger.info('Adding layer %s' % layer['name']) | ||
219 | with open(bblayersconf, 'a+') as f: | ||
220 | f.write("\nBBLAYERS += \"%s\"\n" % layer['path']) | ||
221 | |||
222 | return True | ||
223 | |||
224 | def check_command(error_msg, cmd, cwd=None): | 222 | def check_command(error_msg, cmd, cwd=None): |
225 | ''' | 223 | ''' |
226 | Run a command under a shell, capture stdout and stderr in a single stream, | 224 | Run a command under a shell, capture stdout and stderr in a single stream, |