diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2017-06-27 17:33:38 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-27 22:36:44 +0100 |
commit | 7546daec4fe30d0bd338aac5b8ac4a4add00f137 (patch) | |
tree | 4f383ce988cab468afaa7af1b68173be523f52fa /scripts/lib | |
parent | 8a08f866fcfa7b9568dff1eea3354b971963b34f (diff) | |
download | poky-7546daec4fe30d0bd338aac5b8ac4a4add00f137.tar.gz |
yocto-compat-layer.py: avoid adding layers more than once
add_layer_dependencies() might get called more than once, or one of
the layer dependencies might already be present. The function should
not add layers again because doing so can cause warnings like:
WARNING: Duplicate inclusion for .../meta-openembedded/meta-oe/conf/distro/include/meta_oe_security_flags.inc in .../meta-openembedded/meta-oe/conf/layer.conf
(From OE-Core rev: 9821cec1ca52deee444ae3ff14dc548c8312ba3c)
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-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): |