diff options
-rw-r--r-- | scripts/lib/compatlayer/__init__.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py index e35f8c0d32..eaae4e534f 100644 --- a/scripts/lib/compatlayer/__init__.py +++ b/scripts/lib/compatlayer/__init__.py | |||
@@ -4,6 +4,7 @@ | |||
4 | # Released under the MIT license (see COPYING.MIT) | 4 | # Released under the MIT license (see COPYING.MIT) |
5 | 5 | ||
6 | import os | 6 | import os |
7 | import re | ||
7 | import subprocess | 8 | import subprocess |
8 | from enum import Enum | 9 | from enum import Enum |
9 | 10 | ||
@@ -189,10 +190,22 @@ def add_layer_dependencies(bblayersconf, layer, layers, logger): | |||
189 | if layer_depends is None: | 190 | if layer_depends is None: |
190 | return False | 191 | return False |
191 | else: | 192 | else: |
193 | # Don't add a layer that is already present. | ||
194 | added = set() | ||
195 | output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8') | ||
196 | for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE): | ||
197 | added.add(path) | ||
198 | |||
192 | for layer_depend in layer_depends: | 199 | for layer_depend in layer_depends: |
193 | logger.info('Adding layer dependency %s' % layer_depend['name']) | 200 | name = layer_depend['name'] |
201 | path = layer_depend['path'] | ||
202 | if path in added: | ||
203 | continue | ||
204 | else: | ||
205 | added.add(path) | ||
206 | logger.info('Adding layer dependency %s' % name) | ||
194 | with open(bblayersconf, 'a+') as f: | 207 | with open(bblayersconf, 'a+') as f: |
195 | f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) | 208 | f.write("\nBBLAYERS += \"%s\"\n" % path) |
196 | return True | 209 | return True |
197 | 210 | ||
198 | def add_layer(bblayersconf, layer, layers, logger): | 211 | def add_layer(bblayersconf, layer, layers, logger): |