summaryrefslogtreecommitdiff
path: root/src/buildstream/_sourcecache.py
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-05-01 13:38:35 +0100
committerRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-05-22 14:09:23 +0100
commitc3f96e1bc32f1728619b144e1d0120349411df66 (patch)
treec9ce1b8f1d148ba59c0a236482f6d2f255f0b174 /src/buildstream/_sourcecache.py
parentf958936442b74e46140717a2956b99fc0b835c87 (diff)
downloadbuildstream-c3f96e1bc32f1728619b144e1d0120349411df66.tar.gz
Add BST_STAGE_VIRTUAL_DIRECTORY option
Add flag to indicate whether sources can stage directly to a virtual directory. Adds `__stage_previous_sources` method which stages previous sources taking into account whether they use virtual directories or not. Part of #983
Diffstat (limited to 'src/buildstream/_sourcecache.py')
-rw-r--r--src/buildstream/_sourcecache.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/buildstream/_sourcecache.py b/src/buildstream/_sourcecache.py
index 1d3342a75..ce0694e08 100644
--- a/src/buildstream/_sourcecache.py
+++ b/src/buildstream/_sourcecache.py
@@ -153,11 +153,14 @@ class SourceCache(BaseCache):
for previous_source in previous_sources:
vdir.import_files(self.export(previous_source))
- with utils._tempdir(dir=self.context.tmpdir, prefix='staging-temp') as tmpdir:
- if not vdir.is_empty():
- vdir.export_files(tmpdir)
- source._stage(tmpdir)
- vdir.import_files(tmpdir, can_link=True)
+ if not source.BST_STAGE_VIRTUAL_DIRECTORY:
+ with utils._tempdir(dir=self.context.tmpdir, prefix='staging-temp') as tmpdir:
+ if not vdir.is_empty():
+ vdir.export_files(tmpdir)
+ source._stage(tmpdir)
+ vdir.import_files(tmpdir, can_link=True)
+ else:
+ source._stage(vdir)
self.cas.set_ref(ref, vdir._get_digest())