This is an automated email from the ASF dual-hosted git repository.

not-in-ldap pushed a commit to branch jennis/revert_junction_behaviour
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit bc9154c3a7115ed50ea3f9d4c5d2285b262f55e1
Author: James Ennis <[email protected]>
AuthorDate: Tue Jun 25 12:24:26 2019 +0100

    _project.py: Revert back to not caching junctioned elements
    
    Originally, the intended default behaviour of BuildStream was to
    only cache project elements in project specific remotes.
    
    This behaviour was broken by: 24c0de16faec2b8b9bd6a03504ce951dc49afbe2.
    Introduced in !1113.
    
    This patch reverts the behaviour and asserts that junctioned elements
    are not pushed to their parent's project-specific remote.
---
 src/buildstream/_basecache.py    |  6 +++++-
 src/buildstream/_project.py      | 10 +---------
 tests/artifactcache/junctions.py |  2 +-
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/buildstream/_basecache.py b/src/buildstream/_basecache.py
index 52b777f..5d93562 100644
--- a/src/buildstream/_basecache.py
+++ b/src/buildstream/_basecache.py
@@ -102,10 +102,14 @@ class BaseCache():
     #
     @classmethod
     def _configured_remote_cache_specs(cls, context, project):
+        project_overrides = context.get_overrides(project.name)
+        project_extra_specs = cls.specs_from_config_node(project_overrides)
+
         project_specs = getattr(project, cls.spec_name)
         context_specs = getattr(context, cls.spec_name)
 
-        return list(utils._deduplicate(project_specs + context_specs))
+        return list(utils._deduplicate(
+            project_extra_specs + project_specs + context_specs))
 
     # setup_remotes():
     #
diff --git a/src/buildstream/_project.py b/src/buildstream/_project.py
index 9428ab4..8d06c7c 100644
--- a/src/buildstream/_project.py
+++ b/src/buildstream/_project.py
@@ -643,15 +643,7 @@ class Project():
         #
 
         # Load artifacts pull/push configuration for this project
-        project_specs = ArtifactCache.specs_from_config_node(config, 
self.directory)
-        override_specs = ArtifactCache.specs_from_config_node(
-            self._context.get_overrides(self.name), self.directory)
-
-        self.artifact_cache_specs = override_specs + project_specs
-
-        if self.junction:
-            parent = self.junction._get_project()
-            self.artifact_cache_specs = parent.artifact_cache_specs + 
self.artifact_cache_specs
+        self.artifact_cache_specs = 
ArtifactCache.specs_from_config_node(config, self.directory)
 
         # Load source caches with pull/push config
         self.source_cache_specs = SourceCache.specs_from_config_node(config, 
self.directory)
diff --git a/tests/artifactcache/junctions.py b/tests/artifactcache/junctions.py
index 34d6916..c93d79c 100644
--- a/tests/artifactcache/junctions.py
+++ b/tests/artifactcache/junctions.py
@@ -57,7 +57,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_shared(cli, share, base_project, 'base-element.bst', 
project_name='base')
+        assert_not_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')

Reply via email to