summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-08-30 17:31:01 +0900
committerTristan van Berkom <tristan@codethink.co.uk>2020-08-30 17:36:30 +0900
commitdef801ba92939c462d105e4883c451e3475db0b0 (patch)
treec90cbd116b0d22047d91d7e0115f17a9f9b544c6
parentee927b2c03806da80b9dc09e24a937e886700071 (diff)
downloadbuildstream-tristan/scriptelement-simplify-again.tar.gz
scriptelement.py: Remove legacy manual creation of staging directory.tristan/scriptelement-simplify-again
This branch statement comes from a time before virtual directories when we were using os.makedirs() to create the target directory, and was then ported to use virtual directories for that purpose. However, during the same migration, the Element.stage_artifact() function was made to guarantee the existence of the staging root location, with a call to: vbasedir.descend( ... staging directory ..., create=True) This makes the branch statement in scriptelement.py redundant.
-rw-r--r--src/buildstream/scriptelement.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/buildstream/scriptelement.py b/src/buildstream/scriptelement.py
index e2b59cb4e..d930d96b0 100644
--- a/src/buildstream/scriptelement.py
+++ b/src/buildstream/scriptelement.py
@@ -238,16 +238,10 @@ class ScriptElement(Element):
continue
element = self.search(Scope.BUILD, item["element"])
- if item["destination"] == "/":
- with self.timed_activity("Staging {} at /".format(element.name), silent_nested=True):
- element.stage_dependency_artifacts(sandbox, Scope.RUN)
- else:
- with self.timed_activity(
- "Staging {} at {}".format(element.name, item["destination"]), silent_nested=True
- ):
- virtual_dstdir = sandbox.get_virtual_directory()
- virtual_dstdir.descend(*item["destination"].lstrip(os.sep).split(os.sep), create=True)
- element.stage_dependency_artifacts(sandbox, Scope.RUN, path=item["destination"])
+ with self.timed_activity(
+ "Staging {} at {}".format(element.name, item["destination"]), silent_nested=True
+ ):
+ element.stage_dependency_artifacts(sandbox, Scope.RUN, path=item["destination"])
with sandbox.batch(SandboxFlags.NONE):
for item in self.__layout: