diff options
Diffstat (limited to 'scripts/yocto-check-layer')
-rwxr-xr-x | scripts/yocto-check-layer | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/scripts/yocto-check-layer b/scripts/yocto-check-layer index b7c83c8b54..dd930cdddd 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, check_bblayers | 27 | from checklayer import LayerType, detect_layers, add_layers, add_layer_dependencies, get_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' |
@@ -51,6 +51,8 @@ def main(): | |||
51 | help='File to output log (optional)', action='store') | 51 | help='File to output log (optional)', action='store') |
52 | parser.add_argument('--dependency', nargs="+", | 52 | parser.add_argument('--dependency', nargs="+", |
53 | help='Layers to process for dependencies', action='store') | 53 | help='Layers to process for dependencies', action='store') |
54 | parser.add_argument('--no-auto-dependency', help='Disable automatic testing of dependencies', | ||
55 | action='store_true') | ||
54 | parser.add_argument('--machines', nargs="+", | 56 | parser.add_argument('--machines', nargs="+", |
55 | help='List of MACHINEs to be used during testing', action='store') | 57 | help='List of MACHINEs to be used during testing', action='store') |
56 | parser.add_argument('--additional-layers', nargs="+", | 58 | parser.add_argument('--additional-layers', nargs="+", |
@@ -121,6 +123,21 @@ def main(): | |||
121 | if not layers: | 123 | if not layers: |
122 | return 1 | 124 | return 1 |
123 | 125 | ||
126 | # Find all dependencies, and get them checked too | ||
127 | if not args.no_auto_dependency: | ||
128 | depends = [] | ||
129 | for layer in layers: | ||
130 | layer_depends = get_layer_dependencies(layer, dep_layers, logger) | ||
131 | if layer_depends: | ||
132 | for d in layer_depends: | ||
133 | if d not in depends: | ||
134 | depends.append(d) | ||
135 | |||
136 | for d in depends: | ||
137 | if d not in layers: | ||
138 | logger.info("Adding %s to the list of layers to test, as a dependency", d['name']) | ||
139 | layers.append(d) | ||
140 | |||
124 | shutil.copyfile(bblayersconf, bblayersconf + '.backup') | 141 | shutil.copyfile(bblayersconf, bblayersconf + '.backup') |
125 | def cleanup_bblayers(signum, frame): | 142 | def cleanup_bblayers(signum, frame): |
126 | shutil.copyfile(bblayersconf + '.backup', bblayersconf) | 143 | shutil.copyfile(bblayersconf + '.backup', bblayersconf) |
@@ -138,6 +155,9 @@ def main(): | |||
138 | layer['type'] == LayerType.ERROR_BSP_DISTRO: | 155 | layer['type'] == LayerType.ERROR_BSP_DISTRO: |
139 | continue | 156 | continue |
140 | 157 | ||
158 | # Reset to a clean backup copy for each run | ||
159 | shutil.copyfile(bblayersconf + '.backup', bblayersconf) | ||
160 | |||
141 | if check_bblayers(bblayersconf, layer['path'], logger): | 161 | if check_bblayers(bblayersconf, layer['path'], logger): |
142 | logger.info("%s already in %s. To capture initial signatures, layer under test should not present " | 162 | 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'])) | 163 | "in BBLAYERS. Please remove %s from BBLAYERS." % (layer['name'], bblayersconf, layer['name'])) |
@@ -149,17 +169,13 @@ def main(): | |||
149 | logger.info("Setting up for %s(%s), %s" % (layer['name'], layer['type'], | 169 | logger.info("Setting up for %s(%s), %s" % (layer['name'], layer['type'], |
150 | layer['path'])) | 170 | layer['path'])) |
151 | 171 | ||
152 | shutil.copyfile(bblayersconf + '.backup', bblayersconf) | ||
153 | |||
154 | missing_dependencies = not add_layer_dependencies(bblayersconf, layer, dep_layers, logger) | 172 | missing_dependencies = not add_layer_dependencies(bblayersconf, layer, dep_layers, logger) |
155 | if not missing_dependencies: | 173 | if not missing_dependencies: |
156 | for additional_layer in additional_layers: | 174 | for additional_layer in additional_layers: |
157 | if not add_layer_dependencies(bblayersconf, additional_layer, dep_layers, logger): | 175 | if not add_layer_dependencies(bblayersconf, additional_layer, dep_layers, logger): |
158 | missing_dependencies = True | 176 | missing_dependencies = True |
159 | break | 177 | break |
160 | if not add_layer_dependencies(bblayersconf, layer, dep_layers, logger) or \ | 178 | if missing_dependencies: |
161 | any(map(lambda additional_layer: not add_layer_dependencies(bblayersconf, additional_layer, dep_layers, logger), | ||
162 | additional_layers)): | ||
163 | logger.info('Skipping %s due to missing dependencies.' % layer['name']) | 179 | logger.info('Skipping %s due to missing dependencies.' % layer['name']) |
164 | results[layer['name']] = None | 180 | results[layer['name']] = None |
165 | results_status[layer['name']] = 'SKIPPED (Missing dependencies)' | 181 | results_status[layer['name']] = 'SKIPPED (Missing dependencies)' |