diff options
author | Darius Makovsky <traveltissues@protonmail.com> | 2019-11-04 11:47:01 +0000 |
---|---|---|
committer | Darius Makovsky <traveltissues@protonmail.com> | 2019-11-04 14:07:38 +0000 |
commit | 1a1d4592d32d96604aa72bc169388a8f5e42238d (patch) | |
tree | 7c062bca73572e9baa2114145474dfc5f66a89e8 /src/buildstream/element.py | |
parent | 861f9636a503f6dbd5acc132e2f8ba6743762216 (diff) | |
download | buildstream-traveltissues/splitdepkeys.tar.gz |
[WIP]Split dependencies into dependency-names and dependency-keystraveltissues/splitdepkeys
In Element._calculate_cache_key the dependency field of the cache key
dictionary is replaced with the dependency-names field and the
dependency-keys field. The first is only populated in the case where the
weak dependencies are passed and the second is only populated when the
strong dependencies are passed. Additionally, in the case where the
element holds at least one source advertising BST_NO_REF, the new fields
are both initialised to `[]` in order to correctly update dependencies.
Failing to reinitialise dependency fields in this case will lead to
erroneous dependencies from old states of BST_NO_REF sources.
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r-- | src/buildstream/element.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 0efb6b48c..6bb00d393 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -258,6 +258,7 @@ class Element(Plugin): self.__cached_remotely = None # Whether the element is cached remotely # List of Sources self.__sources = [] # type: List[Source] + self.__has_no_ref_source = False # at least one of the sources advertises BST_NO_REF = True self.__weak_cache_key = None # Our cached weak cache key self.__strict_cache_key = None # Our cached cache key for strict builds self.__artifacts = context.artifactcache # Artifact cache @@ -2167,6 +2168,8 @@ class Element(Plugin): self.__cache_key_dict['sources'] = [] for source in self.__sources: + if source.BST_NO_REF: + self.__has_no_ref_source = True self.__cache_key_dict['sources'].append( {'key': source._get_unique_key(), 'name': source._get_source_name()}) @@ -2174,13 +2177,15 @@ class Element(Plugin): self.__cache_key_dict['fatal-warnings'] = sorted(project._fatal_warnings) cache_key_dict = self.__cache_key_dict.copy() - cache_key_dict['dependency-keys-strong'] = [] - cache_key_dict['dependency-keys-weak'] = [] - if dep_strength == _KeyStrength.WEAK: - cache_key_dict['dependency-keys-weak'] = dependencies + if self.__has_no_ref_source: + cache_key_dict['dependency-names'] = [] + cache_key_dict['dependency-keys'] = [] + + if dep_strength == _KeyStrength.WEAK and not self.BST_STRICT_REBUILD: + cache_key_dict['dependency-names'] = dependencies else: - cache_key_dict['dependency-keys-strong'] = dependencies + cache_key_dict['dependency-keys'] = dependencies return _cachekey.generate_key(cache_key_dict) |