From 70040a5c509077fb4044ad0ff583a4b0bc9c77e0 Mon Sep 17 00:00:00 2001 From: Abderrahim Kitouni Date: Tue, 23 Jun 2020 12:17:17 +0100 Subject: loader.py: use the full name of the element when looking up a workspace This fixes a bug where buildstream would ignore the opened workspace on a cross-junction element. --- src/buildstream/_loader/loader.py | 2 +- tests/frontend/cross_junction_workspace.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/buildstream/_loader/loader.py b/src/buildstream/_loader/loader.py index a3af70f4b..9f881743d 100644 --- a/src/buildstream/_loader/loader.py +++ b/src/buildstream/_loader/loader.py @@ -281,7 +281,7 @@ class Loader: # if there's a workspace for this element then just append a dummy workspace # metasource. - workspace = self.load_context.context.get_workspaces().get_workspace(element.name) + workspace = self.load_context.context.get_workspaces().get_workspace(element.full_name) skip_workspace = True if workspace: workspace_node = {"kind": "workspace"} diff --git a/tests/frontend/cross_junction_workspace.py b/tests/frontend/cross_junction_workspace.py index 5e25d1fa8..c3b80ae0a 100644 --- a/tests/frontend/cross_junction_workspace.py +++ b/tests/frontend/cross_junction_workspace.py @@ -48,15 +48,18 @@ def prepare_junction_project(cli, tmpdir): def open_cross_junction(cli, tmpdir): project = prepare_junction_project(cli, tmpdir) - workspace = tmpdir.join("workspace") - element = "sub.bst:data.bst" + + oldkey = cli.get_element_key(project, element) + + workspace = tmpdir.join("workspace") args = ["workspace", "open", "--directory", str(workspace), element] result = cli.run(project=project, args=args) result.assert_success() assert cli.get_element_state(project, element) == "buildable" assert os.path.exists(str(workspace.join("hello.txt"))) + assert cli.get_element_key(project, element) != oldkey return project, workspace -- cgit v1.2.1