You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/03/03 08:05:47 UTC
[buildstream] branch bst-1 updated: _context.py: Ensure paths in
user configuration are absolute
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch bst-1
in repository https://gitbox.apache.org/repos/asf/buildstream.git
The following commit(s) were added to refs/heads/bst-1 by this push:
new ad094e7 _context.py: Ensure paths in user configuration are absolute
new ca15d2c Merge pull request #1449 from abderrahim/abderrahim/absolute-paths
ad094e7 is described below
commit ad094e7cc6caa4df339d80f115287ff174e22085
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Thu Aug 29 16:22:40 2019 +0200
_context.py: Ensure paths in user configuration are absolute
Relative paths don't make sense in user configuration. The exception is
workspacedir where `.` is useful as it will be combined with the name
specified on the command line.
---
buildstream/_context.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/buildstream/_context.py b/buildstream/_context.py
index 8ee45f7..e26f65b 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -181,6 +181,12 @@ class Context():
path = os.path.normpath(path)
setattr(self, directory, path)
+ # Relative paths don't make sense in user configuration. The exception is
+ # workspacedir where `.` is useful as it will be combined with the name
+ # specified on the command line.
+ if not os.path.isabs(path) and not (directory == 'workspacedir' and path == '.'):
+ raise LoadError("{} must be an absolute path".format(directory), LoadErrorReason.INVALID_DATA)
+
# Load quota configuration
# We need to find the first existing directory in the path of
# our artifactdir - the artifactdir may not have been created