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:14:10 UTC

[buildstream] 25/30: Fix 'first pass config' behavior for loading elements

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 356a6347db62a2c560b4aa19b6d8ff8317542aca
Author: Valentin David <va...@codethink.co.uk>
AuthorDate: Mon Jul 2 11:52:39 2018 +0200

    Fix 'first pass config' behavior for loading elements
---
 buildstream/_loader/loader.py      | 6 +++---
 buildstream/_loader/metaelement.py | 4 +++-
 buildstream/element.py             | 8 ++++----
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py
index 3637f39..bc43180 100644
--- a/buildstream/_loader/loader.py
+++ b/buildstream/_loader/loader.py
@@ -448,7 +448,8 @@ class Loader():
                                    _yaml.node_get(node, Mapping, Symbol.ENVIRONMENT, default_value={}),
                                    _yaml.node_get(node, list, Symbol.ENV_NOCACHE, default_value=[]),
                                    _yaml.node_get(node, Mapping, Symbol.PUBLIC, default_value={}),
-                                   _yaml.node_get(node, Mapping, Symbol.SANDBOX, default_value={}))
+                                   _yaml.node_get(node, Mapping, Symbol.SANDBOX, default_value={}),
+                                   element_kind == 'junction')
 
         # Cache it now, make sure it's already there before recursing
         self._meta_elements[element_name] = meta_element
@@ -521,8 +522,7 @@ class Loader():
                             "{}: Expected junction but element kind is {}".format(filename, meta_element.kind))
 
         platform = Platform.get_platform()
-        element = Element._new_from_meta(meta_element, platform.artifactcache,
-                                         first_pass=True)
+        element = Element._new_from_meta(meta_element, platform.artifactcache)
         element._preflight()
 
         for source in element.sources():
diff --git a/buildstream/_loader/metaelement.py b/buildstream/_loader/metaelement.py
index 16788e9..b846546 100644
--- a/buildstream/_loader/metaelement.py
+++ b/buildstream/_loader/metaelement.py
@@ -38,7 +38,8 @@ class MetaElement():
     #    sandbox: Configuration specific to the sandbox environment
     #
     def __init__(self, project, name, kind, provenance, sources, config,
-                 variables, environment, env_nocache, public, sandbox):
+                 variables, environment, env_nocache, public, sandbox,
+                 first_pass):
         self.project = project
         self.name = name
         self.kind = kind
@@ -52,3 +53,4 @@ class MetaElement():
         self.sandbox = sandbox
         self.build_dependencies = []
         self.dependencies = []
+        self.first_pass = first_pass
diff --git a/buildstream/element.py b/buildstream/element.py
index 7365894..aa49484 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -891,9 +891,9 @@ class Element(Plugin):
     #    (Element): A newly created Element instance
     #
     @classmethod
-    def _new_from_meta(cls, meta, artifacts, first_pass=False):
+    def _new_from_meta(cls, meta, artifacts):
 
-        if first_pass:
+        if meta.first_pass:
             plugins = meta.project.first_pass_config.plugins
         else:
             plugins = meta.project.plugins
@@ -917,10 +917,10 @@ class Element(Plugin):
 
         # Instantiate dependencies
         for meta_dep in meta.dependencies:
-            dependency = Element._new_from_meta(meta_dep, artifacts, first_pass=first_pass)
+            dependency = Element._new_from_meta(meta_dep, artifacts)
             element.__runtime_dependencies.append(dependency)
         for meta_dep in meta.build_dependencies:
-            dependency = Element._new_from_meta(meta_dep, artifacts, first_pass=first_pass)
+            dependency = Element._new_from_meta(meta_dep, artifacts)
             element.__build_dependencies.append(dependency)
 
         return element