summaryrefslogtreecommitdiff
path: root/buildstream/_stream.py
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2018-09-18 18:14:06 +0100
committerChandan Singh <csingh43@bloomberg.net>2018-09-18 18:58:04 +0100
commit2a3359d31a69a54841d237a14bcaed4aa6ad40e1 (patch)
treea874a9ebb5067a0a68a0b297a58b5a7ef51020fe /buildstream/_stream.py
parent3b81d4510656fcff808e4c37e29ac4a2f5e38de6 (diff)
downloadbuildstream-chandan/fix-source-bundle.tar.gz
_stream.py: Ensure source-bundle's source directory existschandan/fix-source-bundle
Currently, `source-bundle` command is entirely broken as it tries to stage the sources in a directory that doesn't exist. Fix it by ensuring that we create the necessary directories before calling any methods that try to use those directories. This fix comes with a regression test to ensure that the basic use-case of `source-bundle` continues to work in future. Fixes https://gitlab.com/BuildStream/buildstream/issues/651.
Diffstat (limited to 'buildstream/_stream.py')
-rw-r--r--buildstream/_stream.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index cceb3d3a5..f3ef5b3da 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -703,6 +703,7 @@ class Stream():
# Create a temporary directory to build the source tree in
builddir = self._context.builddir
+ os.makedirs(builddir, exist_ok=True)
prefix = "{}-".format(target.normal_name)
with TemporaryDirectory(prefix=prefix, dir=builddir) as tempdir:
@@ -1088,6 +1089,7 @@ class Stream():
for element in elements:
source_dir = os.path.join(directory, "source")
element_source_dir = os.path.join(source_dir, element.normal_name)
+ os.makedirs(element_source_dir)
element._stage_sources_at(element_source_dir)