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-06 14:38:06 +0100 |
commit | 4afb7c3c505a4d21906f07f88c966b794a968cbc (patch) | |
tree | 59e3eba36193cae377b7fa68bef957b269bd1804 /scripts/lib | |
parent | 7b8ae7711273e32a187830c7fab493e6fbb065c3 (diff) | |
download | openembedded-core-4afb7c3c505a4d21906f07f88c966b794a968cbc.tar.gz openembedded-core-4afb7c3c505a4d21906f07f88c966b794a968cbc.tar.bz2 openembedded-core-4afb7c3c505a4d21906f07f88c966b794a968cbc.zip |
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
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
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 @@ # Released under the MIT license (see COPYING.MIT) import os +import re import subprocess from enum import Enum @@ -189,10 +190,22 @@ def add_layer_dependencies(bblayersconf, layer, layers, logger): if layer_depends is None: return False else: + # Don't add a layer that is already present. + added = set() + output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8') + for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE): + added.add(path) + for layer_depend in layer_depends: - logger.info('Adding layer dependency %s' % layer_depend['name']) + name = layer_depend['name'] + path = layer_depend['path'] + if path in added: + continue + else: + added.add(path) + logger.info('Adding layer dependency %s' % name) with open(bblayersconf, 'a+') as f: - f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) + f.write("\nBBLAYERS += \"%s\"\n" % path) return True def add_layer(bblayersconf, layer, layers, logger): |