From f1f79c845862a422b7de3cd5540b6217621bb309 Mon Sep 17 00:00:00 2001 From: Abderrahim Kitouni Date: Fri, 2 Aug 2024 11:51:49 +0100 Subject: [PATCH] _context: use artifact caches from the parent project for junctions This makes a junction use the artifact cache of the parent project before the ones defined for the junction This was originally done in 24c0de16faec2b8b9bd6a03504ce951dc49afbe2, but regressed at some point Fixes https://github.com/apache/buildstream/issues/1839 --- src/buildstream/_context.py | 7 +++++++ tests/artifactcache/junctions.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/buildstream/_context.py b/src/buildstream/_context.py index 6124e5e60..3e4da1f2b 100644 --- a/src/buildstream/_context.py +++ b/src/buildstream/_context.py @@ -807,6 +807,13 @@ def _resolve_specs_for_project( # If there are any project recommendations, append them at the end project_remotes = getattr(project, project_attribute) + + junction = project.junction + while junction: + parent_project = junction._get_project() + project_remotes = getattr(parent_project, project_attribute) + project_remotes + junction = parent_project.junction + remotes = list(utils._deduplicate(remotes + project_remotes)) return remotes diff --git a/tests/artifactcache/junctions.py b/tests/artifactcache/junctions.py index 08401e1a6..8f5e5218b 100644 --- a/tests/artifactcache/junctions.py +++ b/tests/artifactcache/junctions.py @@ -68,7 +68,7 @@ def test_push_pull(cli, tmpdir, datafiles): # In the parent project's cache assert_shared(cli, share, project, "target.bst", project_name="parent") assert_shared(cli, share, project, "app.bst", project_name="parent") - assert_not_shared(cli, share, base_project, "base-element.bst", project_name="base") + assert_shared(cli, share, base_project, "base-element.bst", project_name="base") # In the junction project's cache assert_not_shared(cli, base_share, project, "target.bst", project_name="parent")