summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-02-23 19:53:16 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-02-25 00:19:19 +0900
commitf6ceefbb3dabc11b34c6b380925eaecccfa99060 (patch)
tree8d2357f7a820fbbb4e2da66e0b84ba8ae5a08f74
parent81acb103e88583d50dbd1f622bb89188d8194629 (diff)
downloadbuildstream-f6ceefbb3dabc11b34c6b380925eaecccfa99060.tar.gz
_project.py: Parse the new 'shell' section
This new section informs BuildStream how to launch interactive shells for the specific project. These new options are part of the effort to make applications work better inside a `bst shell` environment, issue #223 Initial options include: o Default shell command to run for an interactive shell, this is used for interactive debugging sessions, and also if no command was specified in `bst shell` o List of environment variables to inherit from user environment, this is useful to propagate some host stuff into the environment for debugging; and only considered when it is not an "isolated" shell. These changes also bump the BST_FORMAT_VERSION
-rw-r--r--buildstream/_project.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/buildstream/_project.py b/buildstream/_project.py
index cb19b55e3..dd5862a3e 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -37,9 +37,9 @@ from ._sourcefactory import SourceFactory
# The base BuildStream format version
#
# This version is bumped whenever enhancements are made
-# to the ``project.conf`` format or the format in general.
+# to the `project.conf` format or the core element format.
#
-BST_FORMAT_VERSION = 0
+BST_FORMAT_VERSION = 1
# The separator we use for user specified aliases
_ALIAS_SEPARATOR = ':'
@@ -79,6 +79,10 @@ class Project():
self._element_format_versions = {}
self._fail_on_overlap = False
+ # Shell options
+ self._shell_command = [] # The default interactive shell command
+ self._shell_env_inherit = [] # Environment vars to inherit when non-isolated
+
profile_start(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-'))
self._load()
profile_end(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-'))
@@ -139,7 +143,7 @@ class Project():
'split-rules', 'elements', 'plugins',
'aliases', 'name',
'artifacts', 'options',
- 'fail-on-overlap'
+ 'fail-on-overlap', 'shell'
])
# The project name, element path and option declarations
@@ -269,6 +273,14 @@ class Project():
self._fail_on_overlap = _yaml.node_get(config, bool, 'fail-on-overlap',
default_value=False)
+ # Parse shell options
+ shell_options = _yaml.node_get(config, Mapping, 'shell', default_value={})
+ _yaml.node_validate(shell_options, ['command', 'environment-inherit'])
+ self._shell_command = _yaml.node_get(shell_options, list, 'command',
+ default_value=['sh', '-i'])
+ self._shell_env_inherit = _yaml.node_get(shell_options, list, 'environment-inherit',
+ default_value=[])
+
# _store_origin()
#
# Helper function to store plugin origins