diff options
author | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-06-08 16:41:44 +0900 |
---|---|---|
committer | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-06-23 19:27:10 +0900 |
commit | 5f75fefe5f66175664bd7ab317552fd1a2c6b650 (patch) | |
tree | 8a329028945a8a82c20bd97ca84b43052f0d1753 /src/buildstream/_project.py | |
parent | f6c200ec92001c048a8276f4f8a8a59bdc9e7a84 (diff) | |
download | buildstream-5f75fefe5f66175664bd7ab317552fd1a2c6b650.tar.gz |
junctions: Replace coalescing with explicit overrides
This patch removes the functionality of coalescing junction
configurations on junction element names, and replaces it with
an explicit format which allows junction declarations to override
junctions in subprojects with junction declarations from the local
project.
Changes:
* plugins/elements/junction.py: Load the overrides dictionary
* exceptions.py: Added new CIRCULAR_REFERENCE to LoadErrorReason.
* _loader/loadcontext.py: Add new register_loader() function which
is called by the Loader to register all loaders with the context,
delegating the task of detecting conflicting junctions to the
load context.
* _loader/loader.py: When loading a junction, check if there is
an override from the parent project and use that instead.
Register with the LoadContext, and pass the LoadContext
and provenance along when creating a Project
Further, we now protect against circular element path references
with a new _loader_search_provenances table.
* _project.py: Pass new `provenance` member through the constructor
and onwards into the child loader.
Diffstat (limited to 'src/buildstream/_project.py')
-rw-r--r-- | src/buildstream/_project.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py index e0ddf3d41..fcfb31988 100644 --- a/src/buildstream/_project.py +++ b/src/buildstream/_project.py @@ -99,6 +99,7 @@ class Project: cli_options=None, default_mirror=None, parent_loader=None, + provenance=None, search_for_project=True, ): @@ -164,7 +165,7 @@ class Project: self._project_includes = None with PROFILER.profile(Topics.LOAD_PROJECT, self.directory.replace(os.sep, "-")): - self._load(parent_loader=parent_loader) + self._load(parent_loader=parent_loader, provenance=provenance) self._partially_loaded = True @@ -653,7 +654,7 @@ class Project: # # Raises: LoadError if there was a problem with the project.conf # - def _load(self, *, parent_loader=None): + def _load(self, *, parent_loader=None, provenance=None): # Load builtin default projectfile = os.path.join(self.directory, _PROJECT_CONF_FILE) @@ -700,7 +701,7 @@ class Project: # Fatal warnings self._fatal_warnings = pre_config_node.get_str_list("fatal-warnings", default=[]) - self.loader = Loader(self, parent=parent_loader) + self.loader = Loader(self, parent=parent_loader, provenance=provenance) self._project_includes = Includes(self.loader, copy_tree=False) |