diff options
Diffstat (limited to 'bitbake')
| -rw-r--r-- | bitbake/lib/layerindexlib/__init__.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/bitbake/lib/layerindexlib/__init__.py b/bitbake/lib/layerindexlib/__init__.py index d231cf6a99..77196b408f 100644 --- a/bitbake/lib/layerindexlib/__init__.py +++ b/bitbake/lib/layerindexlib/__init__.py | |||
| @@ -376,7 +376,7 @@ layerBranches set. If not, they are effectively blank.''' | |||
| 376 | invalid.append(name) | 376 | invalid.append(name) |
| 377 | 377 | ||
| 378 | 378 | ||
| 379 | def _resolve_dependencies(layerbranches, ignores, dependencies, invalid): | 379 | def _resolve_dependencies(layerbranches, ignores, dependencies, invalid, processed=None): |
| 380 | for layerbranch in layerbranches: | 380 | for layerbranch in layerbranches: |
| 381 | if ignores and layerbranch.layer.name in ignores: | 381 | if ignores and layerbranch.layer.name in ignores: |
| 382 | continue | 382 | continue |
| @@ -388,6 +388,13 @@ layerBranches set. If not, they are effectively blank.''' | |||
| 388 | if ignores and deplayerbranch.layer.name in ignores: | 388 | if ignores and deplayerbranch.layer.name in ignores: |
| 389 | continue | 389 | continue |
| 390 | 390 | ||
| 391 | # Since this is depth first, we need to know what we're currently processing | ||
| 392 | # in order to avoid infinite recursion on a loop. | ||
| 393 | if processed and deplayerbranch.layer.name in processed: | ||
| 394 | # We have found a recursion... | ||
| 395 | logger.warning('Circular layer dependency found: %s -> %s' % (processed, deplayerbranch.layer.name)) | ||
| 396 | continue | ||
| 397 | |||
| 391 | # This little block is why we can't re-use the LayerIndexObj version, | 398 | # This little block is why we can't re-use the LayerIndexObj version, |
| 392 | # we must be able to satisfy each dependencies across layer indexes and | 399 | # we must be able to satisfy each dependencies across layer indexes and |
| 393 | # use the layer index order for priority. (r stands for replacement below) | 400 | # use the layer index order for priority. (r stands for replacement below) |
| @@ -411,7 +418,17 @@ layerBranches set. If not, they are effectively blank.''' | |||
| 411 | 418 | ||
| 412 | # New dependency, we need to resolve it now... depth-first | 419 | # New dependency, we need to resolve it now... depth-first |
| 413 | if deplayerbranch.layer.name not in dependencies: | 420 | if deplayerbranch.layer.name not in dependencies: |
| 414 | (dependencies, invalid) = _resolve_dependencies([deplayerbranch], ignores, dependencies, invalid) | 421 | # Avoid recursion on this branch. |
| 422 | # We copy so we don't end up polluting the depth-first branch with other | ||
| 423 | # branches. Duplication between individual branches IS expected and | ||
| 424 | # handled by 'dependencies' processing. | ||
| 425 | if not processed: | ||
| 426 | local_processed = [] | ||
| 427 | else: | ||
| 428 | local_processed = processed.copy() | ||
| 429 | local_processed.append(deplayerbranch.layer.name) | ||
| 430 | |||
| 431 | (dependencies, invalid) = _resolve_dependencies([deplayerbranch], ignores, dependencies, invalid, local_processed) | ||
| 415 | 432 | ||
| 416 | if deplayerbranch.layer.name not in dependencies: | 433 | if deplayerbranch.layer.name not in dependencies: |
| 417 | dependencies[deplayerbranch.layer.name] = [deplayerbranch, layerdependency] | 434 | dependencies[deplayerbranch.layer.name] = [deplayerbranch, layerdependency] |
