You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:13:52 UTC

[buildstream] 07/30: Rename BST_NO_PROJECT_DEFAULTS to (not) BST_PROJECT_INCLUDES_PROCESSED

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch valentindavid/flatpak-demo
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 420054b1bd4dd8d9bab075b67900c0834cddb355
Author: Valentin David <va...@codethink.co.uk>
AuthorDate: Fri Jun 22 10:29:23 2018 +0200

    Rename BST_NO_PROJECT_DEFAULTS to (not) BST_PROJECT_INCLUDES_PROCESSED
---
 buildstream/_loader/loader.py            |  4 +++-
 buildstream/element.py                   | 23 +++++++++++++----------
 buildstream/plugins/elements/junction.py |  2 +-
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py
index c5bce62..9c83f1e 100644
--- a/buildstream/_loader/loader.py
+++ b/buildstream/_loader/loader.py
@@ -250,7 +250,9 @@ class Loader():
             kind_type, _ = self.project.first_pass_config.plugins.get_element_type(kind)
         except PluginError:
             kind_type = None
-        if kind_type and hasattr(kind_type, 'BST_NO_PROJECT_DEFAULTS') and kind_type.BST_NO_PROJECT_DEFAULTS:
+        if (kind_type and
+                hasattr(kind_type, 'BST_PROJECT_INCLUDES_PROCESSED') and
+                not kind_type.BST_PROJECT_INCLUDES_PROCESSED):
             self._first_pass_options.process_node(node)
         else:
             if not self.project.is_loaded():
diff --git a/buildstream/element.py b/buildstream/element.py
index ee523ff..ae604c5 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -191,8 +191,11 @@ class Element(Plugin):
     *Since: 1.2*
     """
 
-    BST_NO_PROJECT_DEFAULTS = False
-    """
+    BST_PROJECT_INCLUDES_PROCESSED = True
+    """Whether to load the plugin before processing include directives in
+    project.conf.
+
+    *Since: 1.2*
 
     """
 
@@ -200,7 +203,7 @@ class Element(Plugin):
 
         super().__init__(meta.name, context, project, meta.provenance, "element")
 
-        if not project.is_loaded() and not self.BST_NO_PROJECT_DEFAULTS:
+        if not project.is_loaded() and self.BST_PROJECT_INCLUDES_PROCESSED:
             raise ElementError("{}: Cannot load element before project"
                                .format(self), reason="project-not-loaded")
 
@@ -909,7 +912,7 @@ class Element(Plugin):
 
         # Instantiate sources
         for meta_source in meta.sources:
-            meta_source.first_pass = element.BST_NO_PROJECT_DEFAULTS
+            meta_source.first_pass = not element.BST_PROJECT_INCLUDES_PROCESSED
             source = plugins.create_source(meta_source)
             redundant_ref = source._load_ref()
             element.__sources.append(source)
@@ -2113,7 +2116,7 @@ class Element(Plugin):
         element_bst = _yaml.node_get(element_public, Mapping, 'bst', default_value={})
         element_splits = _yaml.node_get(element_bst, Mapping, 'split-rules', default_value={})
 
-        if self.BST_NO_PROJECT_DEFAULTS:
+        if not self.BST_PROJECT_INCLUDES_PROCESSED:
             splits = _yaml.node_chain_copy(element_splits)
         elif project._splits is None:
             raise LoadError(LoadErrorReason.INVALID_DATA,
@@ -2149,7 +2152,7 @@ class Element(Plugin):
             # Override the element's defaults with element specific
             # overrides from the project.conf
             project = self._get_project()
-            if self.BST_NO_PROJECT_DEFAULTS:
+            if not self.BST_PROJECT_INCLUDES_PROCESSED:
                 elements = project.first_pass_config.element_overrides
             else:
                 elements = project.element_overrides
@@ -2168,7 +2171,7 @@ class Element(Plugin):
     def __extract_environment(self, meta):
         default_env = _yaml.node_get(self.__defaults, Mapping, 'environment', default_value={})
 
-        if self.BST_NO_PROJECT_DEFAULTS:
+        if not self.BST_PROJECT_INCLUDES_PROCESSED:
             environment = {}
         else:
             project = self._get_project()
@@ -2186,7 +2189,7 @@ class Element(Plugin):
         return final_env
 
     def __extract_env_nocache(self, meta):
-        if self.BST_NO_PROJECT_DEFAULTS:
+        if not self.BST_PROJECT_INCLUDES_PROCESSED:
             project_nocache = []
         else:
             project = self._get_project()
@@ -2210,7 +2213,7 @@ class Element(Plugin):
         default_vars = _yaml.node_get(self.__defaults, Mapping, 'variables', default_value={})
 
         project = self._get_project()
-        if self.BST_NO_PROJECT_DEFAULTS:
+        if not self.BST_PROJECT_INCLUDES_PROCESSED:
             variables = _yaml.node_chain_copy(project.first_pass_config.base_variables)
         else:
             assert project.is_loaded()
@@ -2239,7 +2242,7 @@ class Element(Plugin):
     # Sandbox-specific configuration data, to be passed to the sandbox's constructor.
     #
     def __extract_sandbox_config(self, meta):
-        if self.BST_NO_PROJECT_DEFAULTS:
+        if not self.BST_PROJECT_INCLUDES_PROCESSED:
             sandbox_config = {'build-uid': 0,
                               'build-gid': 0}
         else:
diff --git a/buildstream/plugins/elements/junction.py b/buildstream/plugins/elements/junction.py
index 2f81f46..dc6e385 100644
--- a/buildstream/plugins/elements/junction.py
+++ b/buildstream/plugins/elements/junction.py
@@ -136,7 +136,7 @@ class JunctionElement(Element):
     # Junctions are not allowed any dependencies
     BST_FORBID_BDEPENDS = True
     BST_FORBID_RDEPENDS = True
-    BST_NO_PROJECT_DEFAULTS = True
+    BST_PROJECT_INCLUDES_PROCESSED = False
 
     def configure(self, node):
         self.path = self.node_get_member(node, str, 'path', default='')