summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/checklayer/__init__.py36
-rwxr-xr-xscripts/yocto-check-layer6
2 files changed, 20 insertions, 22 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) 203def 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
217def 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
224def check_command(error_msg, cmd, cwd=None): 222def 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,
diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer
index 9b7e53679b..106c955251 100755
--- a/scripts/yocto-check-layer
+++ b/scripts/yocto-check-layer
@@ -22,7 +22,7 @@ import scriptpath
22scriptpath.add_oe_lib_path() 22scriptpath.add_oe_lib_path()
23scriptpath.add_bitbake_lib_path() 23scriptpath.add_bitbake_lib_path()
24 24
25from checklayer import LayerType, detect_layers, add_layer, add_layer_dependencies, get_signatures 25from checklayer import LayerType, detect_layers, add_layers, add_layer_dependencies, get_signatures
26from oeqa.utils.commands import get_bb_vars 26from oeqa.utils.commands import get_bb_vars
27 27
28PROGNAME = 'yocto-check-layer' 28PROGNAME = 'yocto-check-layer'
@@ -157,7 +157,7 @@ def main():
157 layers_tested = layers_tested + 1 157 layers_tested = layers_tested + 1
158 continue 158 continue
159 159
160 if any(map(lambda additional_layer: not add_layer(bblayersconf, additional_layer, dep_layers, logger), 160 if any(map(lambda additional_layer: not add_layers(bblayersconf, [additional_layer], logger),
161 additional_layers)): 161 additional_layers)):
162 logger.info('Skipping %s due to missing additional layers.' % layer['name']) 162 logger.info('Skipping %s due to missing additional layers.' % layer['name'])
163 results[layer['name']] = None 163 results[layer['name']] = None
@@ -179,7 +179,7 @@ def main():
179 continue 179 continue
180 td['machines'] = args.machines 180 td['machines'] = args.machines
181 181
182 if not add_layer(bblayersconf, layer, dep_layers, logger): 182 if not add_layers(bblayersconf, [layer], logger):
183 logger.info('Skipping %s ???.' % layer['name']) 183 logger.info('Skipping %s ???.' % layer['name'])
184 results[layer['name']] = None 184 results[layer['name']] = None
185 results_status[layer['name']] = 'SKIPPED (Unknown)' 185 results_status[layer['name']] = 'SKIPPED (Unknown)'