You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:41:55 UTC

[buildstream] 01/02: element.py: Force resolve intermediate dependency cache keys

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

root pushed a commit to branch tristan/fix-workspace-build-all
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 2629bdd01197451cde59c94fa52f0d928b5401cf
Author: Tristan Van Berkom <tr...@codethink.co.uk>
AuthorDate: Sun Feb 24 18:45:08 2019 +0900

    element.py: Force resolve intermediate dependency cache keys
    
    When a cache key is discovered (e.g.: due to a workspace build completing),
    then we have no guarantee that reverse dependency cache keys will be
    updated in order.
    
    As such, we must ensure that `Element._update_state()` serializes this
    and ensures that cache keys for intermediate dependencies get resolved.
    
    This fixes #919
---
 buildstream/element.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/buildstream/element.py b/buildstream/element.py
index 5c06065..dac020a 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -1190,6 +1190,18 @@ class Element(Plugin):
                     return
 
         if self.__strict_cache_key is None:
+
+            # We cannot make the assumption that dependency cache keys
+            # have already been resolved if possible.
+            #
+            # If a cache key was recently discovered, we need to be sure
+            # that the interemediate dependencies get their cache keys
+            # resolved before calculating this element's cache key.
+            #
+            for e in self.dependencies(Scope.BUILD):
+                if e.__strict_cache_key is None:
+                    e._update_state()
+
             dependencies = [
                 e.__strict_cache_key for e in self.dependencies(Scope.BUILD)
             ]