_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.
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 @@
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