summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbderrahim Kitouni <akitouni@gnome.org>2020-06-22 15:59:02 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2020-07-29 13:23:50 +0000
commit3e8af8ae40648bbfb174fc998da7eaf6ac008b1f (patch)
tree67bb887cf3cc79059ad1a271f7df138b743523c6
parent409829067dbb5f8f47d1dee105662fc088c8bfa5 (diff)
downloadbuildstream-3e8af8ae40648bbfb174fc998da7eaf6ac008b1f.tar.gz
element.py: move printing the build environment from elementjob.py
-rw-r--r--src/buildstream/_scheduler/jobs/elementjob.py10
-rw-r--r--src/buildstream/element.py5
2 files changed, 5 insertions, 10 deletions
diff --git a/src/buildstream/_scheduler/jobs/elementjob.py b/src/buildstream/_scheduler/jobs/elementjob.py
index 6e035be9c..683129506 100644
--- a/src/buildstream/_scheduler/jobs/elementjob.py
+++ b/src/buildstream/_scheduler/jobs/elementjob.py
@@ -16,9 +16,6 @@
# Author:
# Tristan Daniƫl Maat <tristan.maat@codethink.co.uk>
#
-from ruamel import yaml
-
-from ..._message import MessageType
from .job import Job, ChildJob
@@ -92,13 +89,6 @@ class ChildElementJob(ChildJob):
def child_process(self):
- # Print the element's environment at the beginning of any element's log file.
- #
- # This should probably be omitted for non-build tasks but it's harmless here
- elt_env = self._element.get_environment()
- env_dump = yaml.round_trip_dump(elt_env, default_flow_style=False, allow_unicode=True)
- self.message(MessageType.LOG, "Build environment for element {}".format(self._element.name), detail=env_dump)
-
# Run the action
return self._action_cb(self._element)
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 547397e54..a7a84a379 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -86,6 +86,7 @@ import string
from typing import cast, TYPE_CHECKING, Any, Dict, Iterator, List, Optional, Set
from pyroaring import BitMap # pylint: disable=no-name-in-module
+from ruamel import yaml
from . import _yaml
from ._variables import Variables
@@ -1560,6 +1561,10 @@ class Element(Plugin):
# Assert call ordering
assert not self._cached_success()
+ # Print the environment at the beginning of the log file.
+ env_dump = yaml.round_trip_dump(self.get_environment(), default_flow_style=False, allow_unicode=True)
+ self.log("Build environment for element {}".format(self.name), detail=env_dump)
+
context = self._get_context()
with self._output_file() as output_file: