summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/checklayer/__init__.py21
-rwxr-xr-xscripts/yocto-check-layer6
2 files changed, 26 insertions, 1 deletions
diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py
index e69a10f452..f91888ccbb 100644
--- a/scripts/lib/checklayer/__init__.py
+++ b/scripts/lib/checklayer/__init__.py
@@ -156,6 +156,27 @@ def _find_layer(depend, layers):
156 return layer 156 return layer
157 return None 157 return None
158 158
159def sanity_check_layers(layers, logger):
160 """
161 Check that we didn't find duplicate collection names, as the layer that will
162 be used is non-deterministic. The precise check is duplicate collections
163 with different patterns, as the same pattern being repeated won't cause
164 problems.
165 """
166 import collections
167
168 passed = True
169 seen = collections.defaultdict(set)
170 for layer in layers:
171 for name, data in layer.get("collections", {}).items():
172 seen[name].add(data["pattern"])
173
174 for name, patterns in seen.items():
175 if len(patterns) > 1:
176 passed = False
177 logger.error("Collection %s found multiple times: %s" % (name, ", ".join(patterns)))
178 return passed
179
159def get_layer_dependencies(layer, layers, logger): 180def get_layer_dependencies(layer, layers, logger):
160 def recurse_dependencies(depends, layer, layers, logger, ret = []): 181 def recurse_dependencies(depends, layer, layers, logger, ret = []):
161 logger.debug('Processing dependencies %s for layer %s.' % \ 182 logger.debug('Processing dependencies %s for layer %s.' % \
diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer
index f3cf139d8a..0e5b75b1f7 100755
--- a/scripts/yocto-check-layer
+++ b/scripts/yocto-check-layer
@@ -24,7 +24,7 @@ import scriptpath
24scriptpath.add_oe_lib_path() 24scriptpath.add_oe_lib_path()
25scriptpath.add_bitbake_lib_path() 25scriptpath.add_bitbake_lib_path()
26 26
27from checklayer import LayerType, detect_layers, add_layers, add_layer_dependencies, get_layer_dependencies, get_signatures, check_bblayers 27from checklayer import LayerType, detect_layers, add_layers, add_layer_dependencies, get_layer_dependencies, get_signatures, check_bblayers, sanity_check_layers
28from oeqa.utils.commands import get_bb_vars 28from oeqa.utils.commands import get_bb_vars
29 29
30PROGNAME = 'yocto-check-layer' 30PROGNAME = 'yocto-check-layer'
@@ -119,6 +119,10 @@ def main():
119 for l in dep_layers: 119 for l in dep_layers:
120 dump_layer_debug(l) 120 dump_layer_debug(l)
121 121
122 if not sanity_check_layers(additional_layers + dep_layers, logger):
123 logger.error("Failed layer validation")
124 return 1
125
122 logger.info("Detected layers:") 126 logger.info("Detected layers:")
123 for layer in layers: 127 for layer in layers:
124 if layer['type'] == LayerType.ERROR_BSP_DISTRO: 128 if layer['type'] == LayerType.ERROR_BSP_DISTRO: