summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-22 17:24:32 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-10-22 17:27:54 +0900
commit194284498835395ff3ef52a1776cf8f322e60d49 (patch)
tree15b1e48b0d646dca3be71a13b04998a16984442c
parentb2c7cafe72b76bc563989d2c1920578dec07c3b5 (diff)
downloadbuildstream-194284498835395ff3ef52a1776cf8f322e60d49.tar.gz
element.py: Raise an error if the source staging directory is non-empty
This is the correct place for the check, once for each element in the overall source staging directory.
-rw-r--r--buildstream/element.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index c8fd64ee0..eaaf77bf9 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1382,6 +1382,10 @@ class Element(Plugin):
#
def _stage_sources_at(self, directory):
with self.timed_activity("Staging sources", silent_nested=True):
+
+ if os.path.isdir(directory) and os.listdir(directory):
+ raise ElementError("Staging directory '{}' is not empty".format(directory))
+
for source in self.__sources:
source._stage(directory)