From def801ba92939c462d105e4883c451e3475db0b0 Mon Sep 17 00:00:00 2001 From: Tristan van Berkom Date: Sun, 30 Aug 2020 17:31:01 +0900 Subject: scriptelement.py: Remove legacy manual creation of staging directory. 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. --- src/buildstream/scriptelement.py | 14 ++++---------- 1 file 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: -- cgit v1.2.1