diff options
author | Lee Chee Yang <chee.yang.lee@intel.com> | 2020-07-24 12:16:24 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-07-27 10:37:58 +0100 |
commit | 4cbea1019781e9595655448347a38dae1db5ee29 (patch) | |
tree | 2f6be6ff02d55142cb1488d6bf9d247e1455b398 /scripts | |
parent | 9a0ec350ace36c3b2447fff62726e65d25bcb7db (diff) | |
download | poky-4cbea1019781e9595655448347a38dae1db5ee29.tar.gz |
checklayer: check layer in BBLAYERS before test
layer under test should absent from BBLAYERS when running
yocto-check-layer. This allow to get signatures before layer
under test. There are existing steps to add the layer under
test to BBLAYERS after getting initial signatures.
add steps to check for layer under test in BBLAYERS before
running any test, skip test for the layer if the layer under
test exist in BBLAYERS.
[YOCTO #13176]
(From OE-Core rev: be02e8dbfb0d1decce125322f9f1e11a649756c0)
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/checklayer/__init__.py | 14 | ||||
-rwxr-xr-x | scripts/yocto-check-layer | 9 |
2 files changed, 22 insertions, 1 deletions
diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py index f625d59896..fe545607bb 100644 --- a/scripts/lib/checklayer/__init__.py +++ b/scripts/lib/checklayer/__init__.py | |||
@@ -229,6 +229,20 @@ def add_layers(bblayersconf, layers, logger): | |||
229 | f.write("\nBBLAYERS += \"%s\"\n" % path) | 229 | f.write("\nBBLAYERS += \"%s\"\n" % path) |
230 | return True | 230 | return True |
231 | 231 | ||
232 | def check_bblayers(bblayersconf, layer_path, logger): | ||
233 | ''' | ||
234 | If layer_path found in BBLAYERS return True | ||
235 | ''' | ||
236 | import bb.parse | ||
237 | import bb.data | ||
238 | |||
239 | ldata = bb.parse.handle(bblayersconf, bb.data.init(), include=True) | ||
240 | for bblayer in (ldata.getVar('BBLAYERS') or '').split(): | ||
241 | if os.path.normpath(bblayer) == os.path.normpath(layer_path): | ||
242 | return True | ||
243 | |||
244 | return False | ||
245 | |||
232 | def check_command(error_msg, cmd, cwd=None): | 246 | def check_command(error_msg, cmd, cwd=None): |
233 | ''' | 247 | ''' |
234 | Run a command under a shell, capture stdout and stderr in a single stream, | 248 | 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 ca6c79bc8d..b7c83c8b54 100755 --- a/scripts/yocto-check-layer +++ b/scripts/yocto-check-layer | |||
@@ -24,7 +24,7 @@ import scriptpath | |||
24 | scriptpath.add_oe_lib_path() | 24 | scriptpath.add_oe_lib_path() |
25 | scriptpath.add_bitbake_lib_path() | 25 | scriptpath.add_bitbake_lib_path() |
26 | 26 | ||
27 | from checklayer import LayerType, detect_layers, add_layers, add_layer_dependencies, get_signatures | 27 | from checklayer import LayerType, detect_layers, add_layers, add_layer_dependencies, get_signatures, check_bblayers |
28 | from oeqa.utils.commands import get_bb_vars | 28 | from oeqa.utils.commands import get_bb_vars |
29 | 29 | ||
30 | PROGNAME = 'yocto-check-layer' | 30 | PROGNAME = 'yocto-check-layer' |
@@ -138,6 +138,13 @@ def main(): | |||
138 | layer['type'] == LayerType.ERROR_BSP_DISTRO: | 138 | layer['type'] == LayerType.ERROR_BSP_DISTRO: |
139 | continue | 139 | continue |
140 | 140 | ||
141 | if check_bblayers(bblayersconf, layer['path'], logger): | ||
142 | logger.info("%s already in %s. To capture initial signatures, layer under test should not present " | ||
143 | "in BBLAYERS. Please remove %s from BBLAYERS." % (layer['name'], bblayersconf, layer['name'])) | ||
144 | results[layer['name']] = None | ||
145 | results_status[layer['name']] = 'SKIPPED (Layer under test should not present in BBLAYERS)' | ||
146 | continue | ||
147 | |||
141 | logger.info('') | 148 | logger.info('') |
142 | logger.info("Setting up for %s(%s), %s" % (layer['name'], layer['type'], | 149 | logger.info("Setting up for %s(%s), %s" % (layer['name'], layer['type'], |
143 | layer['path'])) | 150 | layer['path'])) |