summaryrefslogtreecommitdiff
path: root/buildstream/scriptelement.py
diff options
context:
space:
mode:
authorValentin David <valentin.david@codethink.co.uk>2018-11-06 18:54:41 +0100
committerValentin David <valentin.david@codethink.co.uk>2018-11-06 19:00:35 +0100
commita9618e26775a26db3f084f9cb5709e23b2f48f95 (patch)
tree994f378c10e5b2ac72662e5e83aef5f506d6413a /buildstream/scriptelement.py
parent1f7acf748babea91909489d696ce1dcce2232f60 (diff)
downloadbuildstream-valentindavid/script-artifact-corruption.tar.gz
Fix cache corruption by scripts when layout and integration commands are usedvalentindavid/script-artifact-corruption
Root directory was marked as a non-artifact mount, so not using SafeHardLink. However integration commands executed with write access to the root directory. Fixes #749
Diffstat (limited to 'buildstream/scriptelement.py')
-rw-r--r--buildstream/scriptelement.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/buildstream/scriptelement.py b/buildstream/scriptelement.py
index 3a5d914d0..e9ad60c37 100644
--- a/buildstream/scriptelement.py
+++ b/buildstream/scriptelement.py
@@ -201,16 +201,17 @@ class ScriptElement(Element):
# Setup environment
sandbox.set_environment(self.get_environment())
+ # Tell the sandbox to mount the install root
+ directories = {'/': False}
+
# Mark the artifact directories in the layout
for item in self.__layout:
- if item['destination'] != '/':
- if item['element']:
- sandbox.mark_directory(item['destination'], artifact=True)
- else:
- sandbox.mark_directory(item['destination'])
+ destination = item['destination']
+ was_artifact = directories.get(destination, False)
+ directories[destination] = item['element'] or was_artifact
- # Tell the sandbox to mount the install root
- sandbox.mark_directory(self.__install_root)
+ for directory, artifact in directories.items():
+ sandbox.mark_directory(directory, artifact=artifact)
def stage(self, sandbox):