From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- .../poky/bitbake/lib/layerindexlib/__init__.py | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'external/poky/bitbake/lib/layerindexlib/__init__.py') diff --git a/external/poky/bitbake/lib/layerindexlib/__init__.py b/external/poky/bitbake/lib/layerindexlib/__init__.py index cb79cb37..77196b40 100644 --- a/external/poky/bitbake/lib/layerindexlib/__init__.py +++ b/external/poky/bitbake/lib/layerindexlib/__init__.py @@ -1,17 +1,7 @@ # Copyright (C) 2016-2018 Wind River Systems, Inc. # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. +# SPDX-License-Identifier: GPL-2.0-only # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import datetime @@ -386,7 +376,7 @@ layerBranches set. If not, they are effectively blank.''' invalid.append(name) - def _resolve_dependencies(layerbranches, ignores, dependencies, invalid): + def _resolve_dependencies(layerbranches, ignores, dependencies, invalid, processed=None): for layerbranch in layerbranches: if ignores and layerbranch.layer.name in ignores: continue @@ -398,6 +388,13 @@ layerBranches set. If not, they are effectively blank.''' if ignores and deplayerbranch.layer.name in ignores: continue + # Since this is depth first, we need to know what we're currently processing + # in order to avoid infinite recursion on a loop. + if processed and deplayerbranch.layer.name in processed: + # We have found a recursion... + logger.warning('Circular layer dependency found: %s -> %s' % (processed, deplayerbranch.layer.name)) + continue + # This little block is why we can't re-use the LayerIndexObj version, # we must be able to satisfy each dependencies across layer indexes and # use the layer index order for priority. (r stands for replacement below) @@ -421,7 +418,17 @@ layerBranches set. If not, they are effectively blank.''' # New dependency, we need to resolve it now... depth-first if deplayerbranch.layer.name not in dependencies: - (dependencies, invalid) = _resolve_dependencies([deplayerbranch], ignores, dependencies, invalid) + # Avoid recursion on this branch. + # We copy so we don't end up polluting the depth-first branch with other + # branches. Duplication between individual branches IS expected and + # handled by 'dependencies' processing. + if not processed: + local_processed = [] + else: + local_processed = processed.copy() + local_processed.append(deplayerbranch.layer.name) + + (dependencies, invalid) = _resolve_dependencies([deplayerbranch], ignores, dependencies, invalid, local_processed) if deplayerbranch.layer.name not in dependencies: dependencies[deplayerbranch.layer.name] = [deplayerbranch, layerdependency] -- cgit 1.2.3-korg