summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2017-03-20 17:33:26 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-22 11:35:22 +0000
commitf57eac5dc9253ea2bf769011b8be29d3fff9fdd1 (patch)
tree47c5d279fa2402eded65546e491ce1bbdb5808f4 /scripts
parent4703aa2b3ba25f463826f9f6eb38b69fa649b572 (diff)
downloadpoky-f57eac5dc9253ea2bf769011b8be29d3fff9fdd1.tar.gz
scripts/yocto-compat-layer.py: Handle layer dependencies when test
If some layer depends on other tries to find layer dependency, if the layer dependency isn't found avoid to test the layer and notice the user. (From OE-Core rev: 1e7cf9bb71521f1632dd2e6b01fe7fcc95732983) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/compatlayer/__init__.py29
-rwxr-xr-xscripts/yocto-compat-layer.py21
2 files changed, 41 insertions, 9 deletions
diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py
index b8ce771319..435679edbf 100644
--- a/scripts/lib/compatlayer/__init__.py
+++ b/scripts/lib/compatlayer/__init__.py
@@ -132,10 +132,37 @@ def detect_layers(layer_directories, no_auto):
132 132
133 return layers 133 return layers
134 134
135def add_layer(bblayersconf, layer): 135def _find_layer_depends(depend, layers):
136 for layer in layers:
137 for collection in layer['collections']:
138 if depend == collection:
139 return layer
140 return None
141
142def add_layer(bblayersconf, layer, layers, logger):
143 logger.info('Adding layer %s' % layer['name'])
144
145 for collection in layer['collections']:
146 for depend in layer['collections'][collection]['depends'].split():
147 # core (oe-core) is suppose to be provided
148 if depend == 'core':
149 continue
150
151 layer_depend = _find_layer_depends(depend, layers)
152 if not layer_depend:
153 logger.error('Layer %s depends on %s and isn\'t found.' % \
154 (layer['name'], depend))
155 return False
156
157 logger.info('Adding layer dependency %s' % layer_depend['name'])
158 with open(bblayersconf, 'a+') as f:
159 f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path'])
160
136 with open(bblayersconf, 'a+') as f: 161 with open(bblayersconf, 'a+') as f:
137 f.write("\nBBLAYERS += \"%s\"\n" % layer['path']) 162 f.write("\nBBLAYERS += \"%s\"\n" % layer['path'])
138 163
164 return True
165
139def get_signatures(builddir, failsafe=False): 166def get_signatures(builddir, failsafe=False):
140 import subprocess 167 import subprocess
141 import re 168 import re
diff --git a/scripts/yocto-compat-layer.py b/scripts/yocto-compat-layer.py
index b4de84a0a5..9e74033340 100755
--- a/scripts/yocto-compat-layer.py
+++ b/scripts/yocto-compat-layer.py
@@ -116,6 +116,7 @@ def main():
116 td['sigs'] = get_signatures(td['builddir']) 116 td['sigs'] = get_signatures(td['builddir'])
117 logger.info('') 117 logger.info('')
118 118
119 layers_tested = 0
119 for layer in layers: 120 for layer in layers:
120 if layer['type'] == LayerType.ERROR_NO_LAYER_CONF or \ 121 if layer['type'] == LayerType.ERROR_NO_LAYER_CONF or \
121 layer['type'] == LayerType.ERROR_BSP_DISTRO: 122 layer['type'] == LayerType.ERROR_BSP_DISTRO:
@@ -123,16 +124,20 @@ def main():
123 124
124 shutil.copyfile(bblayersconf + '.backup', bblayersconf) 125 shutil.copyfile(bblayersconf + '.backup', bblayersconf)
125 126
126 add_layer(bblayersconf, layer) 127 if not add_layer(bblayersconf, layer, layers, logger):
128 continue
129
127 result = test_layer_compatibility(td, layer) 130 result = test_layer_compatibility(td, layer)
128 results[layer['name']] = result 131 results[layer['name']] = result
129 132 layers_tested = layers_tested + 1
130 logger.info('') 133
131 logger.info('Summary of results:') 134 if layers_tested:
132 logger.info('') 135 logger.info('')
133 for layer_name in results: 136 logger.info('Summary of results:')
134 logger.info('%s ... %s' % (layer_name, 'PASS' if \ 137 logger.info('')
135 results[layer_name].wasSuccessful() else 'FAIL')) 138 for layer_name in results:
139 logger.info('%s ... %s' % (layer_name, 'PASS' if \
140 results[layer_name].wasSuccessful() else 'FAIL'))
136 141
137 cleanup_bblayers(None, None) 142 cleanup_bblayers(None, None)
138 143