diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2017-03-30 21:30:29 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-05 23:22:13 +0100 |
commit | 6afe0e07ecc06aa6d2078e659970954beb639bef (patch) | |
tree | 97daaf3ea5c471d4b9f5308747202fca5ecd699a /scripts | |
parent | d2d019a11b48a4537b8ef73c0175302728c807a0 (diff) | |
download | poky-6afe0e07ecc06aa6d2078e659970954beb639bef.tar.gz |
yocto-compat-layer.py: Fix the signature validation
The initial signatures need to be collected -after- the dependency layers have
been added to the system. Otherwise changes that happen due to dependencies,
outside of the layer being scanned, will show up as signature problems.
The add_layer function was split into two pieces so that we can process
the dependencies first, and then add the layer itself for the comparison.
(From OE-Core rev: 4eb0932e755b7cb582a8db811aeed1397ecb92cc)
Signed-off-by: Mark Hatle <mark.hatle@windriver.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__.py | 7 | ||||
-rwxr-xr-x | scripts/yocto-compat-layer.py | 29 |
2 files changed, 23 insertions, 13 deletions
diff --git a/scripts/lib/compatlayer/__init__.py b/scripts/lib/compatlayer/__init__.py index 8d8bdfe939..86f86eb657 100644 --- a/scripts/lib/compatlayer/__init__.py +++ b/scripts/lib/compatlayer/__init__.py | |||
@@ -140,9 +140,7 @@ def _find_layer_depends(depend, layers): | |||
140 | return layer | 140 | return layer |
141 | return None | 141 | return None |
142 | 142 | ||
143 | def add_layer(bblayersconf, layer, layers, logger): | 143 | def add_layer_dependencies(bblayersconf, layer, layers, logger): |
144 | logger.info('Adding layer %s' % layer['name']) | ||
145 | |||
146 | def recurse_dependencies(depends, layer, layers, logger, ret = []): | 144 | def recurse_dependencies(depends, layer, layers, logger, ret = []): |
147 | logger.debug('Processing dependencies %s for layer %s.' % \ | 145 | logger.debug('Processing dependencies %s for layer %s.' % \ |
148 | (depends, layer['name'])) | 146 | (depends, layer['name'])) |
@@ -192,7 +190,10 @@ def add_layer(bblayersconf, layer, layers, logger): | |||
192 | logger.info('Adding layer dependency %s' % layer_depend['name']) | 190 | logger.info('Adding layer dependency %s' % layer_depend['name']) |
193 | with open(bblayersconf, 'a+') as f: | 191 | with open(bblayersconf, 'a+') as f: |
194 | f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) | 192 | f.write("\nBBLAYERS += \"%s\"\n" % layer_depend['path']) |
193 | return True | ||
195 | 194 | ||
195 | def add_layer(bblayersconf, layer, layers, logger): | ||
196 | logger.info('Adding layer %s' % layer['name']) | ||
196 | with open(bblayersconf, 'a+') as f: | 197 | with open(bblayersconf, 'a+') as f: |
197 | f.write("\nBBLAYERS += \"%s\"\n" % layer['path']) | 198 | f.write("\nBBLAYERS += \"%s\"\n" % layer['path']) |
198 | 199 | ||
diff --git a/scripts/yocto-compat-layer.py b/scripts/yocto-compat-layer.py index f8a1ac7468..22c0c2ddea 100755 --- a/scripts/yocto-compat-layer.py +++ b/scripts/yocto-compat-layer.py | |||
@@ -22,7 +22,7 @@ import scriptpath | |||
22 | scriptpath.add_oe_lib_path() | 22 | scriptpath.add_oe_lib_path() |
23 | scriptpath.add_bitbake_lib_path() | 23 | scriptpath.add_bitbake_lib_path() |
24 | 24 | ||
25 | from compatlayer import LayerType, detect_layers, add_layer, get_signatures | 25 | from compatlayer import LayerType, detect_layers, add_layer, add_layer_dependencies, get_signatures |
26 | from oeqa.utils.commands import get_bb_vars | 26 | from oeqa.utils.commands import get_bb_vars |
27 | 27 | ||
28 | PROGNAME = 'yocto-compat-layer' | 28 | PROGNAME = 'yocto-compat-layer' |
@@ -116,29 +116,38 @@ def main(): | |||
116 | results = collections.OrderedDict() | 116 | results = collections.OrderedDict() |
117 | results_status = collections.OrderedDict() | 117 | results_status = collections.OrderedDict() |
118 | 118 | ||
119 | logger.info('') | ||
120 | logger.info('Getting initial bitbake variables ...') | ||
121 | td['bbvars'] = get_bb_vars() | ||
122 | logger.info('Getting initial signatures ...') | ||
123 | td['builddir'] = builddir | ||
124 | td['sigs'] = get_signatures(td['builddir']) | ||
125 | logger.info('') | ||
126 | |||
127 | layers_tested = 0 | 119 | layers_tested = 0 |
128 | for layer in layers: | 120 | for layer in layers: |
129 | if layer['type'] == LayerType.ERROR_NO_LAYER_CONF or \ | 121 | if layer['type'] == LayerType.ERROR_NO_LAYER_CONF or \ |
130 | layer['type'] == LayerType.ERROR_BSP_DISTRO: | 122 | layer['type'] == LayerType.ERROR_BSP_DISTRO: |
131 | continue | 123 | continue |
132 | 124 | ||
125 | logger.info('') | ||
126 | logger.info("Setting up for %s(%s), %s" % (layer['name'], layer['type'], | ||
127 | layer['path'])) | ||
128 | |||
133 | shutil.copyfile(bblayersconf + '.backup', bblayersconf) | 129 | shutil.copyfile(bblayersconf + '.backup', bblayersconf) |
134 | 130 | ||
135 | if not add_layer(bblayersconf, layer, dep_layers, logger): | 131 | if not add_layer_dependencies(bblayersconf, layer, dep_layers, logger): |
136 | logger.info('Skipping %s due to missing dependencies.' % layer['name']) | 132 | logger.info('Skipping %s due to missing dependencies.' % layer['name']) |
137 | results[layer['name']] = None | 133 | results[layer['name']] = None |
138 | results_status[layer['name']] = 'SKIPPED (Missing dependencies)' | 134 | results_status[layer['name']] = 'SKIPPED (Missing dependencies)' |
139 | layers_tested = layers_tested + 1 | 135 | layers_tested = layers_tested + 1 |
140 | continue | 136 | continue |
141 | 137 | ||
138 | logger.info('Getting initial bitbake variables ...') | ||
139 | td['bbvars'] = get_bb_vars() | ||
140 | logger.info('Getting initial signatures ...') | ||
141 | td['builddir'] = builddir | ||
142 | td['sigs'] = get_signatures(td['builddir']) | ||
143 | |||
144 | if not add_layer(bblayersconf, layer, dep_layers, logger): | ||
145 | logger.info('Skipping %s ???.' % layer['name']) | ||
146 | results[layer['name']] = None | ||
147 | results_status[layer['name']] = 'SKIPPED (Unknown)' | ||
148 | layers_tested = layers_tested + 1 | ||
149 | continue | ||
150 | |||
142 | result = test_layer_compatibility(td, layer) | 151 | result = test_layer_compatibility(td, layer) |
143 | results[layer['name']] = result | 152 | results[layer['name']] = result |
144 | results_status[layer['name']] = 'PASS' if results[layer['name']].wasSuccessful() else 'FAIL' | 153 | results_status[layer['name']] = 'PASS' if results[layer['name']].wasSuccessful() else 'FAIL' |