Skip to content

Commit

Permalink
_context: use artifact caches from the parent project for junctions
Browse files Browse the repository at this point in the history
This makes a junction use the artifact cache of the parent project
before the ones defined for the junction

This was originally done in 24c0de1,
but regressed at some point

Fixes #1839
  • Loading branch information
abderrahim committed Aug 2, 2024
1 parent 6b2ebbd commit cbe213c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/buildstream/_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,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
Expand Down
2 changes: 1 addition & 1 deletion tests/artifactcache/junctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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")
Expand Down

0 comments on commit cbe213c

Please sign in to comment.