You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:34:13 UTC

[buildstream] 01/02: element.py: cache key should be set in __update_cache_keys

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

tvb pushed a commit to branch jennis/die_update_state
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 2c9825918e0d56663779b6da727bfb3527a33538
Author: James Ennis <ja...@codethink.co.uk>
AuthorDate: Mon Jun 10 11:44:57 2019 +0100

    element.py: cache key should be set in __update_cache_keys
---
 src/buildstream/element.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index a605460..a448b86 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -3006,6 +3006,8 @@ class Element(Plugin):
     # has changed.
     #
     def __update_cache_keys(self):
+        context = self._get_context()
+
         if self.__weak_cache_key is None:
             # Calculate weak cache key
             # Weak cache key includes names of direct build dependencies
@@ -3033,6 +3035,10 @@ class Element(Plugin):
             ]
             self.__strict_cache_key = self._calculate_cache_key(dependencies)
 
+        # In strict mode, the strong cache key always matches the strict cache key
+        if self.__strict_cache_key is not None and context.get_strict():
+            self.__cache_key = self.__strict_cache_key
+
         if self.__strict_cache_key is not None and self.__can_query_cache_callback is not None:
             self.__can_query_cache_callback(self)
             self.__can_query_cache_callback = None
@@ -3068,7 +3074,6 @@ class Element(Plugin):
 
             # In strict mode, the strong cache key always matches the strict cache key
             if context.get_strict():
-                self.__cache_key = self.__strict_cache_key
                 self.__artifact = self.__strict_artifact
 
     # __update_cache_key_non_strict()