summaryrefslogtreecommitdiffstats
path: root/external/poky/bitbake/lib/layerindexlib
diff options
context:
space:
mode:
Diffstat (limited to 'external/poky/bitbake/lib/layerindexlib')
-rw-r--r--external/poky/bitbake/lib/layerindexlib/__init__.py33
-rw-r--r--external/poky/bitbake/lib/layerindexlib/cooker.py17
-rw-r--r--external/poky/bitbake/lib/layerindexlib/plugin.py16
-rw-r--r--external/poky/bitbake/lib/layerindexlib/restapi.py12
-rw-r--r--external/poky/bitbake/lib/layerindexlib/tests/common.py12
-rw-r--r--external/poky/bitbake/lib/layerindexlib/tests/cooker.py15
-rw-r--r--external/poky/bitbake/lib/layerindexlib/tests/layerindexobj.py18
-rw-r--r--external/poky/bitbake/lib/layerindexlib/tests/restapi.py15
8 files changed, 29 insertions, 109 deletions
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]
diff --git a/external/poky/bitbake/lib/layerindexlib/cooker.py b/external/poky/bitbake/lib/layerindexlib/cooker.py
index 848f0e2e..65b23d08 100644
--- a/external/poky/bitbake/lib/layerindexlib/cooker.py
+++ b/external/poky/bitbake/lib/layerindexlib/cooker.py
@@ -1,22 +1,11 @@
# 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 logging
-import json
-from collections import OrderedDict, defaultdict
+from collections import defaultdict
from urllib.parse import unquote, urlparse
@@ -104,7 +93,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
return index
collections = d.getVar('BBFILE_COLLECTIONS')
- layerconfs = d.varhistory.get_variable_items_files('BBFILE_COLLECTIONS', d)
+ layerconfs = d.varhistory.get_variable_items_files('BBFILE_COLLECTIONS')
bbfile_collections = {layer: os.path.dirname(os.path.dirname(path)) for layer, path in layerconfs.items()}
(_, bb_branch, _, _) = self._get_bitbake_info()
diff --git a/external/poky/bitbake/lib/layerindexlib/plugin.py b/external/poky/bitbake/lib/layerindexlib/plugin.py
index 92a2e978..cadda36c 100644
--- a/external/poky/bitbake/lib/layerindexlib/plugin.py
+++ b/external/poky/bitbake/lib/layerindexlib/plugin.py
@@ -1,27 +1,13 @@
# 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
-
# The file contains:
# LayerIndex exceptions
# Plugin base class
# Utility Functions for working on layerindex data
-import argparse
import logging
-import os
-import bb.msg
logger = logging.getLogger('BitBake.layerindexlib.plugin')
diff --git a/external/poky/bitbake/lib/layerindexlib/restapi.py b/external/poky/bitbake/lib/layerindexlib/restapi.py
index d08eb205..21fd1441 100644
--- a/external/poky/bitbake/lib/layerindexlib/restapi.py
+++ b/external/poky/bitbake/lib/layerindexlib/restapi.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 logging
import json
diff --git a/external/poky/bitbake/lib/layerindexlib/tests/common.py b/external/poky/bitbake/lib/layerindexlib/tests/common.py
index 22a54585..077382f1 100644
--- a/external/poky/bitbake/lib/layerindexlib/tests/common.py
+++ b/external/poky/bitbake/lib/layerindexlib/tests/common.py
@@ -1,17 +1,7 @@
# Copyright (C) 2017-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 unittest
import tempfile
diff --git a/external/poky/bitbake/lib/layerindexlib/tests/cooker.py b/external/poky/bitbake/lib/layerindexlib/tests/cooker.py
index fdbf0911..1d0685e0 100644
--- a/external/poky/bitbake/lib/layerindexlib/tests/cooker.py
+++ b/external/poky/bitbake/lib/layerindexlib/tests/cooker.py
@@ -1,27 +1,14 @@
# Copyright (C) 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 unittest
-import tempfile
import os
import bb
import layerindexlib
from layerindexlib.tests.common import LayersTest
-import logging
class LayerIndexCookerTest(LayersTest):
diff --git a/external/poky/bitbake/lib/layerindexlib/tests/layerindexobj.py b/external/poky/bitbake/lib/layerindexlib/tests/layerindexobj.py
index e2fbb950..de1e4746 100644
--- a/external/poky/bitbake/lib/layerindexlib/tests/layerindexobj.py
+++ b/external/poky/bitbake/lib/layerindexlib/tests/layerindexobj.py
@@ -1,26 +1,10 @@
# Copyright (C) 2017-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 unittest
-import tempfile
-import os
-import bb
from layerindexlib.tests.common import LayersTest
-import logging
class LayerIndexObjectsTest(LayersTest):
def setUp(self):
diff --git a/external/poky/bitbake/lib/layerindexlib/tests/restapi.py b/external/poky/bitbake/lib/layerindexlib/tests/restapi.py
index 58766950..e5ccafe5 100644
--- a/external/poky/bitbake/lib/layerindexlib/tests/restapi.py
+++ b/external/poky/bitbake/lib/layerindexlib/tests/restapi.py
@@ -1,27 +1,14 @@
# Copyright (C) 2017-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 unittest
-import tempfile
import os
-import bb
import layerindexlib
from layerindexlib.tests.common import LayersTest
-import logging
def skipIfNoNetwork():
if os.environ.get("BB_SKIP_NETTESTS") == "yes":